You are here

function logouttab_menu in Logout Tab 5

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

Implementation of hook_menu().

File

./logouttab.module, line 11
Adds a logout tab to the profile area.

Code

function logouttab_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/settings/useraccounthelp',
      'title' => t('User Account helppage settings'),
      'description' => t('Choose the page that the user account help tab link goes to.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'logouttab_admin_settings',
      ),
      'access' => user_access('administer site configuration'),
    );
  }

  //testing to make sure we're in a user profile...
  if (arg(0) == 'user' && is_numeric(arg(1))) {
    global $user;
    $view_access = user_access('access user profiles') && $user->uid == arg(1);
    if ($user !== FALSE && $view_access) {
      $helpurl = variable_get('logouttab_url', 'logout');

      // User help page
      $items[] = array(
        'path' => "user/" . arg(1) . "/" . $helpurl,
        'title' => t('Logout'),
        'weight' => 8,
        'callback' => 'send_to_help_page',
        'callback arguments' => $helpurl,
        //'access' => user_access('maintain own subscriptions'),
        'type' => MENU_LOCAL_TASK,
      );
    }
  }
  return $items;
}