You are here

function signup_node_tab_page in Signup 7

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

Menu callback to handle the default tab at node/N/signups

This tests the user's permission to see what tab they should really see. First, see if they can view a signup user list, and redirect there. If not, see if they can administer signups and redirect there. Finally, if they can at least send a signup broadcast, go there.

Parameters

stdClass $node: Fully loaded node object to generate the node/N/signup menu handler for.

See also

signup_menu()

_signup_menu_access()

1 string reference to 'signup_node_tab_page'
signup_menu in ./signup.module
Implements hook_menu().

File

./signup.module, line 572
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_node_tab_page($node) {
  $list = _signup_menu_access($node, 'list-tab');
  $admin = _signup_menu_access($node, 'admin');
  $broadcast = _signup_menu_access($node, 'broadcast');
  $options = array();
  if (isset($_GET['destination'])) {

    // If we have a redirect destination, we don't want drupal_goto() to send
    // us there yet, but rather send us to the desired page and preserve the
    // destination for next time.
    $options = array(
      'query' => drupal_get_destination(),
    );
    unset($_GET['destination']);
  }
  if ($list) {
    drupal_goto("node/{$node->nid}/signups/list", $options);
  }
  elseif ($admin) {
    drupal_goto("node/{$node->nid}/signups/admin", $options);
  }
  elseif ($broadcast) {
    drupal_goto("node/{$node->nid}/signups/broadcast", $options);
  }
}