forum.pages.inc 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * @file
  4. * User page callbacks for the Forum module.
  5. */
  6. /**
  7. * Page callback: Prints a forum listing.
  8. *
  9. * @param $forum_term
  10. * A tree of all forums for a given taxonomy term ID. Defaults to NULL. See
  11. * the return object of forum_forum_load() for a complete definition.
  12. *
  13. * @return
  14. * A string containing HTML representing the themed forum listing.
  15. *
  16. * @see forum_menu()
  17. */
  18. function forum_page($forum_term = NULL) {
  19. if (!isset($forum_term)) {
  20. // On the main page, display all the top-level forums.
  21. $forum_term = forum_forum_load(0);
  22. }
  23. $forum_per_page = variable_get('forum_per_page', 25);
  24. $sortby = variable_get('forum_order', 1);
  25. if (empty($forum_term->container)) {
  26. $topics = forum_get_topics($forum_term->tid, $sortby, $forum_per_page);
  27. }
  28. else {
  29. $topics = '';
  30. }
  31. 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));
  32. }