You are here

function activity_menu in Activity 5.3

Same name and namespace in other branches
  1. 5.4 activity.module \activity_menu()
  2. 5 activity.module \activity_menu()
  3. 5.2 activity.module \activity_menu()
  4. 6.2 activity.module \activity_menu()
  5. 6 activity.module \activity_menu()
  6. 7 activity.module \activity_menu()

Implementation of hook_menu().

File

./activity.module, line 21
Activity module: Allow users to see their friends' activity on the site.

Code

function activity_menu($may_cache) {
  $items = array();
  global $user;
  if ($may_cache) {
    $items[] = array(
      'path' => 'activity',
      'title' => t('Activity'),
      'callback' => 'activity_page',
      'access' => user_access('view public activity'),
      'weight' => 1,
    );
    $items[] = array(
      'path' => 'activity/all',
      'title' => t('All activity'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'access' => user_access('view public activity'),
    );
    $items[] = array(
      'path' => 'activity/mine',
      'title' => t('My activity'),
      'access' => $user->uid,
      'type' => MENU_LOCAL_TASK,
      'access' => user_access('view own activity'),
    );
    $items[] = array(
      'path' => 'activity/all/feed',
      'title' => t('All activity RSS'),
      'callback' => 'activity_feed',
      'callback arguments' => array(
        ACTIVITY_ALL,
      ),
      'type' => MENU_CALLBACK,
      'access' => user_access('view public activity'),
    );
    $items[] = array(
      'path' => 'activity/all/json',
      'title' => t('All activity JSON'),
      'callback' => 'activity_json',
      'callback arguments' => array(
        ACTIVITY_ALL,
        1,
      ),
      'type' => MENU_CALLBACK,
      'access' => user_access('view public activity'),
    );
    $items[] = array(
      'path' => 'admin/settings/activity',
      'title' => t('Activity Settings'),
      'description' => t('Customize what will display on your users activity page.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'activity_admin_settings',
      ),
    );
  }
  else {
    if ($user->uid) {
      $items[] = array(
        'path' => 'activity/' . $user->uid . '/feed',
        'title' => t('My activity'),
        'callback' => 'activity_feed',
        'callback arguments' => array(
          $user->uid,
        ),
        'type' => MENU_CALLBACK,
      );
      $items[] = array(
        'path' => 'activity/' . $user->uid . '/json',
        'callback' => 'activity_json',
        'callback arguments' => array(
          $user->uid,
          1,
        ),
        'type' => MENU_CALLBACK,
      );
    }
  }
  return $items;
}