You are here

function signup_cancel_signup in Signup 5.2

Same name and namespace in other branches
  1. 5 signup.module \signup_cancel_signup()
  2. 6.2 signup.module \signup_cancel_signup()
  3. 6 signup.module \signup_cancel_signup()
  4. 7 signup.module \signup_cancel_signup()

Callback function for canceling signups

3 calls to signup_cancel_signup()
signup_cancel_multiple_confirm_submit in ./signup.module
Submit handler for the confirm form to cancel multiple signups.
signup_form_cancel_submit in ./signup.module
Submits the cancel signup form
signup_user in ./signup.module
Implementation of hook_user().

File

./signup.module, line 1434
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($uid, $nid, $anon_mail = NULL) {
  $node = node_load($nid);
  $node->signup_total--;

  // Invoke hook_signup_cancel().
  module_invoke_all('signup_cancel', $node, $uid);

  // Delete the record from the {signup_log} table.
  if ($anon_mail) {
    db_query("DELETE FROM {signup_log} WHERE anon_mail = '%s' AND nid = %d", $anon_mail, $nid);
  }
  else {
    db_query('DELETE FROM {signup_log} WHERE uid = %d AND nid = %d', $uid, $nid);
  }
  drupal_set_message(t('Signup to !title cancelled.', array(
    '!title' => l($node->title, "node/{$node->nid}"),
  )));

  // See if signups should be re-opened if the total dropped below the limit.
  _signup_check_limit($node, 'total');
}