You are here

function notify_menu in Notify 5

Same name and namespace in other branches
  1. 5.2 notify.module \notify_menu()
  2. 6 notify.module \notify_menu()
  3. 7 notify.module \notify_menu()

Implementation of hook_menu().

File

./notify.module, line 103

Code

function notify_menu($may_cache) {
  global $user;
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => "user/{$user->uid}/notify",
      'title' => t('My notification settings'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'notify_user_settings_form',
        $user->uid,
      ),
      'access' => user_access('access notify'),
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/user/user/notify',
      'title' => t('Notifications'),
      'callback' => 'drupal_get_form',
      'callback arguments' => 'notify_admin_users',
      'access' => user_access('administer notify'),
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/content/notify',
      'title' => t('Notification settings'),
      'description' => t('Adjust settings for new content notifications sent by e-mail.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => 'notify_admin_settings',
      'access' => user_access('administer notify'),
      'type' => MENU_NORMAL_ITEM,
    );
  }
  else {
    if (arg(0) == 'user' && is_numeric(arg(1)) && arg(1) != $user->uid) {
      $account = user_load(array(
        'uid' => arg(1),
      ));
      if ($account->uid) {
        $items[] = array(
          'path' => 'user/' . $account->uid . '/notify',
          'title' => t('Notification settings'),
          'callback' => 'drupal_get_form',
          'callback arguments' => array(
            'notify_user_settings_form',
            arg(1),
          ),
          'access' => user_access('administer notify'),
          'type' => MENU_LOCAL_TASK,
        );
      }
    }
  }
  return $items;
}