You are here

function signup_save_signup in Signup 6.2

Same name and namespace in other branches
  1. 6 signup.module \signup_save_signup()
  2. 7 signup.module \signup_save_signup()

Save a $signup object to the database.

Parameters

$signup: Fully-loaded signup object to save.

Return value

The return value from drupal_write_record().

See also

signup_load_signup()

drupal_write_record()

2 calls to signup_save_signup()
signup_edit_form_save_submit in includes/signup_edit_form.inc
Submit callback when saving changes to an existing signup.
signup_sign_up_user in ./signup.module
Signs up a user to a node.

File

./signup.module, line 993
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_save_signup(&$signup) {
  $rval = FALSE;
  if (is_array($signup->form_data)) {
    $form_data_array = $signup->form_data;
    $signup->form_data = serialize($form_data_array);
  }
  if (empty($signup->sid)) {
    $hook = 'signup_insert';
    $update = array();
  }
  else {
    $hook = 'signup_update';
    $update = array(
      'sid',
    );
  }
  $rval = drupal_write_record('signup_log', $signup, $update);

  // Restore $signup->form_data if we had to serialized it.
  if (isset($form_data_array)) {
    $signup->form_data = $form_data_array;
  }
  if (!empty($rval)) {

    // If we successfully wrote a record, invoke the appropriate hook.
    module_invoke_all($hook, $signup);
  }

  // Propagate the return value from drupal_write_record().
  return $rval;
}