You are here

function _signup_menu_signup_access in Signup 6.2

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

Determine menu access callback for a specific signup.

Parameters

$signup: The fully-loaded signup object that would be affected.

$op: The operation the menu item would perform. Can be 'edit' or 'cancel'.

Return value

TRUE if the operation should be permitted, otherwise FALSE.

1 call to _signup_menu_signup_access()
signup_handler_field_signup_edit_link::render in views/handlers/signup_handler_field_signup_edit_link.inc
1 string reference to '_signup_menu_signup_access'
signup_menu in ./signup.module
Implementation of hook_menu().

File

./signup.module, line 555
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_menu_signup_access($signup, $op) {
  global $user;
  $node = node_load($signup->nid);

  // Ensure the user still has access to view the node they signed up for.
  if (!node_access('view', $node)) {
    return FALSE;
  }

  // See if the user is allowed to perform the operation on their own signup.
  $permission = "{$op} own signups";
  if (user_access($permission) && $user->uid == $signup->uid) {
    return TRUE;
  }

  // Check admin powers for this signup.
  if (_signup_menu_access($node, 'admin')) {
    return TRUE;
  }
  return FALSE;
}