/[drupal]/contributions/modules/signup/includes/signup_cancel.inc
ViewVC logotype

Contents of /contributions/modules/signup/includes/signup_cancel.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Sun Jan 25 03:10:55 2009 UTC (10 months ago) by dww
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +4 -4 lines
File MIME type: text/x-php
#51226 by dww: Cleaned up the menu access callbacks for editing and
canceling signups, both to share more code, and to enforce that users
must still have access to view the node they signed up for before they
can edit or cancel the signup.
1 <?php
2 // $Id: signup_cancel.inc,v 1.2 2009/01/24 02:15:03 dww Exp $
3
4
5 /**
6 * @file
7 * Code for the page to cancel a signup from a secure link.
8 */
9
10 function signup_cancel_signup_page($signup, $token) {
11 if (signup_valid_token($token, $signup->sid, 'cancel')) {
12 return drupal_get_form('signup_cancel_link_confirm_form', $signup->sid);
13 }
14 drupal_set_message(t('Invalid link to cancel a signup.'), 'error');
15 drupal_goto();
16 }
17
18 function signup_cancel_link_confirm_form($form_state, $sid) {
19 $info = db_fetch_object(db_query("SELECT n.nid, n.title, s.* FROM {node} n INNER JOIN {signup_log} s ON n.nid = s.nid WHERE s.sid = %d", $sid));
20
21 $form = array();
22 $form['sid'] = array(
23 '#type' => 'hidden',
24 '#value' => $sid,
25 );
26 $form['nid'] = array(
27 '#type' => 'hidden',
28 '#value' => $info->nid,
29 );
30 $form['#submit'][] = 'signup_cancel_link_confirm_form_submit';
31
32 $abort_url = isset($_REQUEST['destination']) ? $_REQUEST['destination'] : "node/$info->nid";
33
34 // TODO: Should this include information to identify the username,
35 // anon_mail, and possibly the custom signup form data, too?
36 return confirm_form(
37 $form,
38 t('Are you sure you want to cancel the signup to %node_title?', array('%node_title' => $info->title)),
39 $abort_url,
40 t('This action cannot be undone.'),
41 t('Cancel signup'), t('Keep signup')
42 );
43 }
44
45 function signup_cancel_link_confirm_form_submit($form, &$form_state) {
46 signup_cancel_signup($form_state['values']['sid']);
47 $form_state['redirect'] = 'node/'. $form_state['values']['nid'];
48 }
49

  ViewVC Help
Powered by ViewVC 1.1.2