You are here

function forum_menu in Drupal 5

Same name and namespace in other branches
  1. 4 modules/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/forum.module, line 33
Enable threaded discussions about general topics.

Code

function forum_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'forum',
      'title' => t('Forums'),
      'callback' => 'forum_page',
      'access' => user_access('access content'),
      'type' => MENU_SUGGESTED_ITEM,
    );
    $items[] = array(
      'path' => 'admin/content/forum',
      'title' => t('Forums'),
      'description' => t('Control forums and their hierarchy and change forum settings.'),
      'callback' => 'forum_overview',
      'access' => user_access('administer forums'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/content/forum/list',
      'title' => t('List'),
      'access' => user_access('administer forums'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10,
    );
    $items[] = array(
      'path' => 'admin/content/forum/add/container',
      'title' => t('Add container'),
      'callback' => 'forum_form_main',
      'callback arguments' => array(
        'container',
      ),
      'access' => user_access('administer forums'),
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/content/forum/add/forum',
      'title' => t('Add forum'),
      'callback' => 'forum_form_main',
      'callback arguments' => array(
        'forum',
      ),
      'access' => user_access('administer forums'),
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/content/forum/settings',
      'title' => t('Settings'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'forum_admin_settings',
      ),
      'weight' => 5,
      'access' => user_access('administer forums'),
      'type' => MENU_LOCAL_TASK,
    );
  }
  elseif (is_numeric(arg(5))) {
    $term = taxonomy_get_term(arg(5));

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