You are here

function node_registration_access_toggle_with_token in Node registration 7

Access callback for registration/%node_registration/toggle/ajax/%/%.

1 string reference to 'node_registration_access_toggle_with_token'
node_registration_menu in ./node_registration.module
Implements hook_menu().

File

./node_registration.module, line 434

Code

function node_registration_access_toggle_with_token($registration, $field, $new_value) {

  // Node and NR edit access.
  $node = node_load($registration->nid);
  if (!node_access('update', $node) || !node_registration_access($registration, 'update')) {
    return FALSE;
  }

  // Valid togglable flag.
  if (!in_array($field, array(
    'cancelled',
    'verified',
    'attended',
  ))) {
    return FALSE;
  }

  // Valid csrf token.
  return isset($_GET['token']) && drupal_valid_token($_GET['token'], "nr_toggle_{$field}_{$new_value}");
}