You are here

function forum_menu in Drupal 4

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

Implementation of hook_menu().

File

modules/forum.module, line 45
Enable threaded discussions about general topics.

Code

function forum_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'node/add/forum',
      'title' => t('forum topic'),
      'access' => user_access('create forum topics'),
    );
    $items[] = array(
      'path' => 'forum',
      'title' => t('forums'),
      'callback' => 'forum_page',
      'access' => user_access('access content'),
      'type' => MENU_SUGGESTED_ITEM,
    );
    $items[] = array(
      'path' => 'admin/forum',
      'title' => t('forums'),
      'callback' => 'forum_overview',
      'access' => user_access('administer forums'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/forum/list',
      'title' => t('list'),
      'access' => user_access('administer forums'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10,
    );
    $items[] = array(
      'path' => 'admin/forum/add/container',
      'title' => t('add container'),
      'callback' => 'forum_form_container',
      'access' => user_access('administer forums'),
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/forum/add/forum',
      'title' => t('add forum'),
      'callback' => 'forum_form_forum',
      'access' => user_access('administer forums'),
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/forum/configure',
      'title' => t('configure'),
      'callback' => 'forum_admin_configure',
      'access' => user_access('administer forums'),
      'type' => MENU_LOCAL_TASK,
    );
  }
  elseif (is_numeric(arg(4))) {
    $term = taxonomy_get_term(arg(4));

    // Check if this is a valid term.
    if ($term) {
      $items[] = array(
        'path' => 'admin/forum/edit/container',
        'title' => t('edit container'),
        'callback' => 'forum_form_container',
        'callback arguments' => array(
          (array) $term,
        ),
        'access' => user_access('administer forums'),
        'type' => MENU_CALLBACK,
      );
      $items[] = array(
        'path' => 'admin/forum/edit/forum',
        'title' => t('edit forum'),
        'callback' => 'forum_form_forum',
        'callback arguments' => array(
          (array) $term,
        ),
        'access' => user_access('administer forums'),
        'type' => MENU_CALLBACK,
      );
    }
  }
  return $items;
}