You are here

function notifications_content_menu in Notifications 5

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

Implementation of hook_menu_()

File

notifications_content/notifications_content.module, line 34
Subscriptions to content events

Code

function notifications_content_menu($may_cache) {
  global $user;

  // we need the user to to build some urls
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/messaging/notifications/content',
      'title' => t('Content types'),
      'type' => MENU_LOCAL_TASK,
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'notifications_content_settings_form',
      ),
    );
  }
  else {
    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/thread',
        'type' => MENU_LOCAL_TASK,
        'access' => user_access('subscribe to content'),
        'title' => t('Thread'),
        'callback' => 'notifications_content_page_thread',
        'callback arguments' => array(
          $account,
        ),
        'weight' => 10,
      );
      $items[] = array(
        'path' => 'user/' . $account->uid . '/notifications/nodetype',
        'type' => MENU_LOCAL_TASK,
        'access' => user_access('subscribe to content type'),
        'title' => t('Content type'),
        'callback' => 'notifications_content_page_nodetype',
        'callback arguments' => array(
          $account,
        ),
        'weight' => 10,
      );
      $items[] = array(
        'path' => 'user/' . $account->uid . '/notifications/author',
        'type' => MENU_LOCAL_TASK,
        'access' => user_access('subscribe to author'),
        'title' => t('Author'),
        'callback' => 'notifications_content_page_author',
        'callback arguments' => array(
          $account,
        ),
        'weight' => 10,
      );
    }
  }
  return $items;
}