You are here

function notifications_tags_menu in Notifications 5

Same name and namespace in other branches
  1. 6.4 notifications_tags/notifications_tags.module \notifications_tags_menu()
  2. 6 notifications_tags/notifications_tags.module \notifications_tags_menu()
  3. 6.2 notifications_tags/notifications_tags.module \notifications_tags_menu()
  4. 6.3 notifications_tags/notifications_tags.module \notifications_tags_menu()
  5. 7 notifications_tags/notifications_tags.module \notifications_tags_menu()

Implementation of hook_menu_()

File

notifications_tags/notifications_tags.module, line 10
Subscriptions to taxonomy terms

Code

function notifications_tags_menu($may_cache) {
  global $user;

  // we need the user to to build some urls
  $items = array();
  if (!$may_cache) {
    if ($user->uid && arg(0) == 'user' && is_numeric(arg(1)) && arg(2) == 'notifications' && ($user->uid == arg(1) || user_access('administer notifications'))) {
      $account = $user->uid == arg(1) ? $user : user_load(array(
        'uid' => arg(1),
      ));
      $items[] = array(
        'path' => 'user/' . $account->uid . '/notifications/taxonomy',
        'type' => MENU_LOCAL_TASK,
        'access' => user_access('subscribe to taxonomy terms'),
        'title' => t('Tags'),
        'callback' => 'notifications_tags_user_page',
        'callback arguments' => array(
          $account,
        ),
        'weight' => 10,
      );
    }
  }
  return $items;
}