You are here

function advanced_forum_page in Advanced Forum 6.2

Same name and namespace in other branches
  1. 5 advanced_forum.module \advanced_forum_page()
  2. 6 advanced_forum.module \advanced_forum_page()
  3. 7.2 includes/core-overrides.inc \advanced_forum_page()

Menu callback; prints a forum listing.

1 call to advanced_forum_page()
advanced_forum_forum_page in plugins/tasks/forum.inc
Entry point for our overridden user view.
2 string references to 'advanced_forum_page'
advanced_forum_menu in ./advanced_forum.module
Implementation of hook_menu().
advanced_forum_menu_alter in ./advanced_forum.module
Implementation of hook_menu_alter().

File

includes/core-overrides.inc, line 11
These are functions that are overriding core directly (not theme related.)

Code

function advanced_forum_page($tid = 0) {
  if (!is_numeric($tid)) {
    return MENU_NOT_FOUND;
  }
  $tid = (int) $tid;
  _advanced_forum_add_files();
  $topics = '';
  $forum_per_page = variable_get('forum_per_page', 25);
  $sortby = variable_get('forum_order', 1);
  $forums = advanced_forum_get_forums($tid);
  $parents = taxonomy_get_parents_all($tid);
  if ($tid && !in_array($tid, variable_get('forum_containers', array()))) {
    $topics = advanced_forum_get_topics($tid, $sortby, $forum_per_page);
  }
  $vid = variable_get('forum_nav_vocabulary', '');
  $vocabulary = taxonomy_vocabulary_load($vid);

  // Breadcrumb navigation:
  $breadcrumb[] = l(t('Home'), NULL);
  if ($tid) {
    $breadcrumb[] = l($vocabulary->name, 'forum');
  }
  if ($parents) {
    foreach (array_reverse($parents) as $p) {
      if ($p->tid != $tid) {
        $breadcrumb[] = l($p->name, 'forum/' . $p->tid);
      }
      else {
        $title = $p->name;
      }
    }
  }
  if (empty($title)) {
    $title = $vocabulary->name;
  }
  if (!variable_get('advanced_forum_disable_breadcrumbs', FALSE)) {
    drupal_set_breadcrumb($breadcrumb);
  }
  drupal_set_title(check_plain($title));
  return theme('forums', $forums, $topics, $parents, $tid, $sortby, $forum_per_page);
}