diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-12-24 15:09:43 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-12-24 15:09:43 +0000 |
commit | cb7c2e09ed6f1ba12e8c277f1690576ea802bcb3 (patch) | |
tree | 8f183f0a5815a62c1d4c2b8d5033ec983dcdd2d7 /modules/forum/forum.module | |
parent | 4c06410d18cea85c4c26e5ccb27b75c33aa68340 (diff) | |
download | brdo-cb7c2e09ed6f1ba12e8c277f1690576ea802bcb3.tar.gz brdo-cb7c2e09ed6f1ba12e8c277f1690576ea802bcb3.tar.bz2 |
- Fixed the breadcrumb trail of nested forums. Patch by Goba.
Diffstat (limited to 'modules/forum/forum.module')
-rw-r--r-- | modules/forum/forum.module | 36 |
1 files changed, 10 insertions, 26 deletions
diff --git a/modules/forum/forum.module b/modules/forum/forum.module index f88071178..0fb1722b9 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -154,22 +154,19 @@ function forum_view($node, $main = 0, $page = 0) { // we are previewing $term_data = taxonomy_get_term($node->taxonomy[0]); } - $voc = taxonomy_get_vocabulary($term_data->vid); + // Breadcrumb navigation - $breadcrumb[] = l(t("Home"), NULL); - $breadcrumb[] = l(t("forums"), "forum"); - $breadcrumb[] = l($term_data->name, "forum/$term_data->tid"); - // print the breadcrumb + $breadcrumb = array(l(t("Home"), NULL), l(t("forum"), "forum")); + if ($parents = taxonomy_get_parents_all($term_data->tid)) { + $parents = array_reverse($parents); + foreach ($parents as $p) { + $breadcrumb[] = l($p->name, "forum/$p->tid"); + } + } drupal_set_breadcrumb($breadcrumb); } - // prepare the node content - $node = forum_content($node); - - // print the node - $output .= theme("node", $node, $main, $page); - - return $output; + return theme("node", forum_content($node), $main, $page); } function forum_validate(&$node) { @@ -287,19 +284,6 @@ function forum_get_forums($tid = 0) { return $forums; } -function forum_get_parents($tid) { - if ($tid) { - $parents[] = taxonomy_get_term($tid); - } - $n = 0; - while ($parent = taxonomy_get_parents($parents[$n]->tid)) { - $parents = array_merge($parents, $parent); - $n++; - } - - return $parents; -} - function _forum_num_topics($term) { $value = db_fetch_object(db_query("SELECT COUNT(n.nid) AS count FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid WHERE f.tid = %d AND n.nid = f.nid AND n.status = 1 AND n.type = 'forum'", $term)); return ($value) ? $value->count : 0; @@ -444,7 +428,7 @@ function forum_page() { $offset = ($from / $forum_per_page) + 1; $forums = forum_get_forums($tid); - $parents = forum_get_parents($tid); + $parents = taxonomy_get_parents_all($tid); if ($tid && !in_array($tid, variable_get("forum_containers", array()))) { $topics = forum_get_topics($tid, $sortby, $forum_per_page); } |