Checking if a user has a given role in D6

Drupal's API doesn't contain any ready-made function to check if a user has a certain role. While it's certainly easy enough to do, it can take a moment to figure out initially. Here's a little function that demonstrates how to do it. It isn't itself particularly useful since checking for roles is trivial without it, but it should serve as a point of demonstration.


Changing the 'redirect' value of a Drupal node form in D6

Generally, when you want to change the location that a for redirects to after submission, you usually should set $form_state['#redirect'] within a call to hook_form_alter().


Solution to CCK Field Groups not appearing in hook_form_alter()

One issue that I recently came across with a module I was editing was that the fieldsets / field groups from a CCK type weren't in the $form array passed to hook_form_alter().

According to Andy Chase, In CCK for D5 & D6, the 'fieldgroup' module supplied with CCK is given a weight of '9', which means that it's hooks will be run after most other modules.


Balance Tracker and Maintaining a Community Module

It's been almost a full month since Balance Tracker was released to the Drupal community, and I think it's probably about time to mention it on our website, and try to provide a look into our experience maintaining a community module.

Balance Tracker is a module we wrote to handle user earnings and payouts for a client. The client had a website which paid a commission to users based upon sales, and they needed a way to track how much each user earned in commission, and to track when each user was paid out.

Why we use Drupal

Over the last couple of years, our development approach has shifted considerably. When we originally began doing client work, we regularly used a fairly wide variety of tools (Wordpress, custom apps in PHP, Ruby on Rails, or Java enterprise) in addition to Drupal to accomplish our clients' wide variety of projects.

Subscribe to RSS - Drupal