function signup_user in Signup 5.2
Same name and namespace in other branches
- 5 signup.module \signup_user()
- 6.2 signup.module \signup_user()
- 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 366 - 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['uid'];
}
foreach ($uids as $uid) {
$nids = db_query("SELECT nid FROM {signup_log} WHERE uid = %d", $uid);
while ($data = db_fetch_object($nids)) {
signup_cancel_signup($uid, $data->nid);
}
}
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')) {
$signup_path = './' . drupal_get_path('module', 'signup');
require_once $signup_path . '/includes/views.none.inc';
return _signup_user_no_views($type, $edit, $user, $category);
}
}