You are here

function signup_user in Signup 6.2

Same name and namespace in other branches
  1. 5.2 signup.module \signup_user()
  2. 5 signup.module \signup_user()
  3. 6 signup.module \signup_user()

Implementation of hook_user().

When a user is deleted, cancel all of that user's signups to remove all instances of that user from the {signup_log} table, free up space in nodes with signup limits, etc.

Related topics

File

./signup.module, line 651
The Signup module (http://drupal.org/project/signup) manages replies to nodes. In particular, it's good for event management. Signup supports sending reminder emails and automatically closing signups for nodes with a start time, via the Event…

Code

function signup_user($type, &$edit, &$user, $category = NULL) {
  switch ($type) {
    case 'delete':
      $uids = array();
      if (is_array($edit['accounts'])) {

        // A multi-user delete from Admin > User management > Users.
        $uids = $edit['accounts'];
      }
      else {

        // A single-user delete from the edit tab on the user's profile.
        $uids[] = $edit['_account']->uid;
      }
      foreach ($uids as $uid) {
        $query = db_query("SELECT * FROM {signup_log} WHERE uid = %d", $uid);
        while ($signup = db_fetch_object($query)) {
          signup_cancel_signup($signup);
        }
      }
      break;
  }

  // If we're not using views, we need to support additional user
  // operations, for example, to add the user's current signup
  // schedule to their user profile page.
  if (!module_exists('views')) {
    module_load_include('inc', 'signup', 'includes/no_views');
    return _signup_user_no_views($type, $edit, $user, $category);
  }
}