You are here

function signup_node_tab_page in Signup 6.2

Same name and namespace in other branches
  1. 6 signup.module \signup_node_tab_page()
  2. 7 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. If they have permission to signup for nodes and the site is configured to put the signup form on a separate tab from the node itself, display the current user's signup info (either a form to signup, or their current signup). If not, 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

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

Return value

Either the output of the default task ("Sign up") or redirect to a tab.

See also

signup_menu()

_signup_menu_access()

_signup_current_user_signup();

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

File

./signup.module, line 595
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) {
  $signup = _signup_menu_access($node, 'signup');
  $list = _signup_menu_access($node, 'list-tab');
  $admin = _signup_menu_access($node, 'admin');
  $broadcast = _signup_menu_access($node, 'broadcast');
  if ($signup) {
    module_load_include('inc', 'signup', 'includes/node_output');
    return _signup_current_user_signup($node, 'tab');
  }
  elseif ($list) {
    drupal_goto("node/{$node->nid}/signups/list");
  }
  elseif ($admin) {
    drupal_goto("node/{$node->nid}/signups/admin");
  }
  elseif ($broadcast) {
    drupal_goto("node/{$node->nid}/signups/broadcast");
  }
}