You are here

function tracker_menu in Drupal 4

Same name and namespace in other branches
  1. 5 modules/tracker/tracker.module \tracker_menu()
  2. 6 modules/tracker/tracker.module \tracker_menu()
  3. 7 modules/tracker/tracker.module \tracker_menu()

Implementation of hook_menu().

File

modules/tracker.module, line 33
Enables tracking of recent posts for users.

Code

function tracker_menu($may_cache) {
  global $user;
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'tracker',
      'title' => t('recent posts'),
      'callback' => 'tracker_page',
      'access' => user_access('access content'),
      'weight' => 1,
    );
    if ($user->uid) {
      $items[] = array(
        'path' => 'tracker/all',
        'title' => t('all recent posts'),
        'type' => MENU_DEFAULT_LOCAL_TASK,
      );
      $items[] = array(
        'path' => 'tracker/' . $user->uid,
        'title' => t('my recent posts'),
        'type' => MENU_LOCAL_TASK,
      );
    }
  }
  else {
    if (arg(0) == 'user' && is_numeric(arg(1))) {
      $items[] = array(
        'path' => 'user/' . arg(1) . '/track',
        'title' => t('track'),
        'callback' => 'tracker_track_user',
        'access' => user_access('access content'),
        'type' => MENU_IS_LOCAL_TASK,
      );
      $items[] = array(
        'path' => 'user/' . arg(1) . '/track/posts',
        'title' => t('track posts'),
        'type' => MENU_DEFAULT_LOCAL_TASK,
      );
    }
  }
  return $items;
}