function signup_cancel_signup in Signup 6
Same name and namespace in other branches
- 5.2 signup.module \signup_cancel_signup()
- 5 signup.module \signup_cancel_signup()
- 6.2 signup.module \signup_cancel_signup()
- 7 signup.module \signup_cancel_signup()
Cancel the given signup.
Parameters
$signup: Information about the signup to cancel. Can be either the integer signup ID (sid), or a full object of data about the signup (a complete row from the {signup_log} table.
$notify_user: When set to TRUE, a confirmation message is displayed via drupal_set_message().
3 calls to signup_cancel_signup()
- signup_cancel_action in ./
signup.module - Action callback to cancel a given signup.
- signup_cancel_link_confirm_form_submit in includes/
signup_cancel.inc - signup_user in ./
signup.module - Implementation of hook_user().
File
- ./
signup.module, line 1087 - 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_cancel_signup($signup, $notify_user = TRUE) {
// If we only have a numeric sid argument, load the full signup object.
if (is_numeric($signup)) {
$query = db_query('SELECT * FROM {signup_log} WHERE sid = %d', $signup);
$signup = db_fetch_object($query);
}
$node = node_load($signup->nid);
$effective_total_changed = FALSE;
$node->signup_total--;
if (!empty($signup->count_towards_limit)) {
$node->signup_effective_total -= $signup->count_towards_limit;
$effective_total_changed = TRUE;
}
// Invoke hook_signup_cancel().
module_invoke_all('signup_cancel', $signup, $node);
// Delete the record from the {signup_log} table.
db_query('DELETE FROM {signup_log} WHERE sid = %d', $signup->sid);
if ($notify_user) {
drupal_set_message(t('Signup to !title cancelled.', array(
'!title' => l($node->title, "node/{$node->nid}"),
)));
}
if ($effective_total_changed) {
// See if signups should be re-opened if the total dropped below the limit.
_signup_check_limit($node, 'total');
}
}