You are here

function forum_page in Drupal 7

Same name and namespace in other branches
  1. 4 modules/forum.module \forum_page()
  2. 5 modules/forum/forum.module \forum_page()
  3. 6 modules/forum/forum.pages.inc \forum_page()

Page callback: Prints a forum listing.

Parameters

$forum_term: A tree of all forums for a given taxonomy term ID. Defaults to NULL. See the return object of forum_forum_load() for a complete definition.

Return value

A string containing HTML representing the themed forum listing.

See also

forum_menu()

1 string reference to 'forum_page'
forum_menu in modules/forum/forum.module
Implements hook_menu().

File

modules/forum/forum.pages.inc, line 20
User page callbacks for the Forum module.

Code

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

    // On the main page, display all the top-level forums.
    $forum_term = forum_forum_load(0);
  }
  $forum_per_page = variable_get('forum_per_page', 25);
  $sortby = variable_get('forum_order', 1);
  if (empty($forum_term->container)) {
    $topics = forum_get_topics($forum_term->tid, $sortby, $forum_per_page);
  }
  else {
    $topics = '';
  }
  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,
  ));
}