You are here

function advanced_forum_page in Advanced Forum 7.2

Same name and namespace in other branches
  1. 5 advanced_forum.module \advanced_forum_page()
  2. 6.2 includes/core-overrides.inc \advanced_forum_page()
  3. 6 advanced_forum.module \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
Implements hook_menu().
advanced_forum_menu_alter in ./advanced_forum.module
Implements hook_menu_alter().

File

includes/core-overrides.inc, line 11
User page callbacks for the forum module.

Code

function advanced_forum_page($forum_term = NULL) {
  if (!isset($forum_term)) {

    // On the main page, display all the top-level forums.
    $forum_term = advanced_forum_forum_load(0);
  }

  // Set tid for <root> container.
  if (!isset($forum_term->tid)) {
    $forum_term->tid = 0;
  }
  _advanced_forum_add_files();
  $forum_per_page = variable_get('forum_per_page', 25);
  $sortby = variable_get('forum_order', 1);
  if (empty($forum_term->container)) {
    $topics = advanced_forum_get_topics($forum_term->tid, $sortby, $forum_per_page);
  }
  else {
    $topics = '';
  }
  $vid = variable_get('forum_nav_vocabulary', 0);
  $vocabulary = taxonomy_vocabulary_load($vid);

  // Breadcrumb navigation:
  $breadcrumb[] = l(t('Home'), NULL);
  if ($forum_term->tid) {
    $breadcrumb[] = l($vocabulary->name, 'forum');
  }
  if ($forum_term->parents) {
    foreach (array_reverse($forum_term->parents) as $p) {
      if ($p->tid != $forum_term->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($title);
  return theme('forums', array(
    'forums' => $forum_term->forums,
    'topics' => $topics,
    'parents' => $forum_term->parents,
    'tid' => $forum_term->tid,
    'sortby' => $sortby,
    'forums_per_page' => $forum_per_page,
  ));
}