Experimental project

This is a sandbox project, which contains experimental code for developer use only.

NOTE: I've abandoned this and it does not do anything... It's just a bunch of code that I spent a day on that somebody might find useful..

I started this because I needed to extend the role_expire module's functionality to send notifications when a role was about to expire. I ran into troubles using ubercart's role expiration system, because I needed more complexity to the rules involved with role assignment.

I took a lot of ideas and code from this thread: http://drupal.org/node/827594

I ended up abandoning this in favor of a setup in ubercart's module, but this could be useful for anyone looking to pick up where I left off.

What this does do now:

  • adds 2 tables to your db, 1 for keeping track of who's been notified about what role and another for storing settings
  • provides a settings page where an admin with the right permission can configure notification settings
  • settings configurable are: email body, email subject, to/from and a message on user page
  • hooks into cron and checks the database of users against settings and calls a function that should send mail (never finished that)
  • shows token help on email body
  • integrates with role_expire

What is missing:

  • testing of everything beyond setting up settings on the provided admin page
  • integration with rules that doesn't require php to be executed (see below)
  • maintenance of records database for expired users
  • displaying a message
  • hook token to provide email tokens
  • implementing token_replace
  • proper email configuration


  • Install module (depends on role_expire)
  • Go to /admin/settings/role_expire_notification and set up some messages for your roles
  • Set up this php code somewhere: (like rules, execute php):
if($account) {

  $rid = 19;//role id to be assigned and set up for revocation...
  $uid = $account->uid;

  //update user in DB
  db_query("INSERT INTO {users_roles} (uid, rid) VALUES(%d, %d)", $uid, $rid);
  //set up expiration based on default duration setting (set in admin/user/roles/edit/x)
  $expiry_timestamp = role_expire_get_default_duration($rid);
  role_expire_write_record($uid, $rid, $expiry_timestamp) ;
  //set up notification
  role_expire_notification_queue_to_notify($rid, $uid);


I'd recommend setting up ubercart if you're using ubercart!

Project information

  • caution Seeking new maintainer
    The current maintainers are looking for new people to take ownership.
  • caution No further development
    No longer developed by its maintainers.
  • Module categories: User Management