Last Ubercart Alpha Version Reached

After a fine wrestling match in the office with CVS, tags, and project releases on d.o, I finally got the initial Alpha 8 release of Ubercart out the door. The last few alpha versions have seen marathons of development and feature additions, and this "minor" release is no different. Thanks in large part to Shawn and Lyle on the Ubercart team, we now have core functionality for file downloads and expirable role promotions (depending on a customer's purchases) and a good base of Workflow-ng integration providing administrators with a UI to create custom order workflows.

The two most requested features from folks I met at Drupalcon were related to the selling of digital goods and user account roles, and Shawn was able to use work that had already been contributed by third party developers (aymerick, CpILL, torgosPizza, and others) as a starting point for some really great module additions to the Ubercore. No time for a complete feature list here, and really no space either. Both modules are packed with excellent functionality, and we're already seeing a very positive response.

Warner Brothers Records has launched their first artist site using Ubercart selling Avenged Sevenfold fan club memberships with the new roles module and Workflow-ng support. Furthermore, the soon to be released redesign of Mike Nelson's RiffTrax will use Ubercart to sell downloads of the trax through a sharp looking custom catalog. The feedback and contributions from both these companies has been very helpful as we've implemented the new features.

So... all that combines together to make this one of the most exciting Ubercart releases to date. What's even better is this will be our last alpha version. We usually hit the minor versions pretty quick with install and update function fixes, but there will be no moving to Alpha 9. From here, we'll head to beta and beyond. Once we hit the 1.0 milestone, we'll set to work frantically updating Ubercart for Drupal 6 and finally get to a point where we can start using this for our own company's sites!

For those interested in demoing some of these new features, you can check out the recently revamped Ubercart Livetest. The site is running the latest code and demos a lot of the key features of Ubercart. (This product, for example, demos the file download system integrated with the product attribute system to sell music either as a CD or mp3 download.) Granted, I'm particularly proud of what goes on "under the hood" in the administrative menus and forms, but I'm also happy with the way the front end is working out. As elv pointed out indirectly through a post at g.d.o/usability, the user experience is very important, and we're working to make the customer user experience better with each new release.

So... feel free to check it out and post any bugs or suggestions in the appropriate forum, and while you're there, you may as well start dreaming of all the ways you can use Ubercart in your future projects. Wink

(Click here to view the news post at If this sounds like cool software to you, please vote for Ubercart at Intel's Cool Software site. We're not doing so bad in the rankings. 8))

Astronauts and Emergency Repair Missions...

Really, this news story covers the stuff my sci-fi dreams have been made of for years. I'm a total space fanatic, and the thought that somewhere high above us an astronaut is conducting an emergency repair mission on the International Space Station just blows my mind. These are the latest pioneers and adventurers, and I wish I had the opportunity to do some of the same work!

Check it out:

(Planning on setting up the first web development company and Bible study on the moon!)

EDIT: Found a cool image of the repair in action on Time's website.

Orange Jello is Mighty Nice

My wife made me some orange Jello with chopped up bananas and oranges in it. I posted before about how much I love pudding cups, and I still do. Let it also be known that I love Jello. A few interesting facts about eating Jello for your bedtime snack...

  • You might knock a cup of water over when you get Jello out of the refrigerator and try to set it on the kitchen table in the dark.
  • You might only find forks in the silverware drawer.
  • It's hard to eat Jello, especially the small pieces at the end, with a fork.
  • It's even harder to finish off a cup of Jello with a fork quietly so as to not wake your loving wife who made you the treat.
  • Jello should be eaten in a bowl, because a cup (once again) just isn't big enough!

Checking if a Drupal User has a Role

UPDATE: Over five years later, this post is still one of the most highly trafficked on my blog. Since then I've learned a lot and shared many other tips and modules. This past year I was honored to be a contributor to The Definitive Guide to Drupal 7, which includes many other great tips like this. I highly recommend it if you want to get the latest and greatest information on developing for Drupal.

I'm a little curious why a simple function to check if a user has a role doesn't exist in Drupal yet. Such curiosity that makes me wonder if I've just managed to miss it as long as I've been working with Drupal, so someone feel free to enlighten me. If anyone is looking for the same, please read on...

A fairly common task for me when adding PHP to CCK fields, Views arguments, content templates, etc. is to check whether the current user has been assigned a certain role. Generally in module development you're dealing with permissions and use user_access(), but when you're just customizing a site you often need such role based logic. (Drupal core has some, like the access settings for blocks.)

Use the following simple snippet to check if a user (in this example, it's the logged in user since I'm getting the global $user) has been assigned a certain role on your site:

global $user;

// Check to see if $user has the administrator role.
if (in_array('administrator', array_values($user->roles))) {
// Do something.

Replace 'administrator' with whatever role it is you're trying to check against. Alternatively, if you keep a helper module for use on your projects, go ahead and drop this function in it:

 * Check to see if a user has been assigned a certain role.
 * @param $role
 *   The name of the role you're trying to find.
 * @param $user
 *   The user object for the user you're checking; defaults to the current user.
 * @return
 *   TRUE if the user object has the role, FALSE if it does not.
function user_has_role($role, $user = NULL) {
  if (
$user == NULL) {

  if (
is_array($user->roles) && in_array($role, array_values($user->roles))) {


Please let me know if I put a typo up here or you know of an existing or easier way to do this!