You are here

function og_notifications_menu in Organic groups 5.7

Same name and namespace in other branches
  1. 5.8 og_notifications/og_notifications.module \og_notifications_menu()
  2. 5 og_notifications/og_notifications.module \og_notifications_menu()
  3. 5.3 og_notifications/og_notifications.module \og_notifications_menu()
  4. 6.2 modules/og_notifications/og_notifications.module \og_notifications_menu()
  5. 6 modules/og_notifications/og_notifications.module \og_notifications_menu()

Implementation of hook_menu_()

File

og_notifications/og_notifications.module, line 14
Subscriptions to content in groups.

Code

function og_notifications_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/group',
        'access' => user_access('subscribe to content in groups'),
        'title' => t('Groups'),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'og_notifications_user_page',
          $account,
        ),
        'type' => MENU_LOCAL_TASK,
        'weight' => 10,
      );
      $items[] = array(
        'path' => 'user/' . $account->uid . '/notifications/grouptype',
        'access' => user_access('subscribe to content in groups'),
        'title' => t('Groups'),
        'callback' => 'og_notifications_grouptype_user_page',
        'callback arguments' => array(
          $account,
        ),
        'type' => MENU_CALLBACK,
      );
    }
  }
  return $items;
}