rsvp_update

Definition

rsvp_update($edit)
rsvp/rsvp.module, line 996

Description

  • Updates an rsvp
*
  • *

Parameters

$edit The post data of the update rsvp form.

  • @return boolean true on success.

Code

<?php
function rsvp_update($edit) {
  $fields[] = 'timestamp = %d';
  $vals[] = time();

  foreach (array('name', 'invite_text', 'blind', 'list_email', 'allow_invite') as $key) {
    $fields[] = $key ." = '%s'";
    $vals[] = $edit[$key];
  }

  if (!$edit['rid']) {
    return FALSE;
  }
  else {
    $vals[] = $edit['rid'];
  }

  $vals[] = $rid;
  
  $sql = 'UPDATE {rsvp} SET '. implode(', ', $fields) .' WHERE rid = %d';

  if (db_query($sql, $vals)) {
    drupal_set_message(t('RSVP updated.'));
    return TRUE;
  }
  else {
    drupal_set_message(t('There was an error updating the RSVP.'));
    return FALSE;
  }
}
?>