rsvp_view_invite($hash, $action = NULL)
rsvp/rsvp.module, line 401
themed rsvp invite view response.
| Name | Description |
|---|---|
| core functions for rsvp. |
<?php
function rsvp_view_invite($hash, $action = NULL) {
global $user;
$invite = _rsvp_get_invite($hash);
switch ($action) {
default:
// check if the invitation exists
if (!$invite->rid) {
drupal_set_message(t('The invitation you requested does not exist.'));
drupal_goto('rsvp');
}
$rsvp = rsvp_load($invite->rid);
$node = node_load($rsvp->nid);
// check if the event has been deleted
if (!$node->nid) {
drupal_set_message(t('The invitation you are trying to view belongs to an event that has been deleted.'));
//drupal_goto();
}
// This isn't here by mistake: I think we need to log the user action
// even if the event has expired.
db_query('UPDATE {rsvp_invite} SET invited = 1, received = 1 WHERE hash = \'%s\'', $hash);
// show the invitation
$content .= rsvp_view($rsvp->rid);
// check if the event has expired
if (time() >= $node->event_end) {
drupal_set_message(t('You can no longer respond to this invitation since the event has expired.'));
}
else {
$content .= theme('rsvp_reply', drupal_get_form('rsvp_reply_form', $hash));
$form = NULL;
if (_rsvp_is_invite_viral($invite->rid)) {
$form = drupal_get_form('rsvp_attendee_form', $invite->rid);
}
if (_rsvp_is_invite_message_enabled($invite->rid)) {
$form .= '<h2>'. t('You may also message the attendees of this invite using the form below') .':</h2>';
$form .= drupal_get_form('rsvp_message_form', $invite->rid, $hash);
}
if ($form) {
$content .= theme('rsvp_invite_action', $form);
}
}
$content = theme('rsvp_invite', $invite, $rsvp, $content);
break;
case 'status':
// show attendee status
$content = rsvp_attendee_status($hash);
break;
case 'remove':
// attempt to remove an attendee
$rsvp = rsvp_load($invite->rid);
$content = drupal_get_form('rsvp_attendee_confirm_remove', $hash, $rsvp->nid, $rsvp->rid);
break;
}
return $content;
}
?>