Report abuse
function phptemplate_forum_display($forums, $topics, $parents, $tid, $sortby, $forum_per_page) {
global $user;
$vocabulary = taxonomy_get_vocabulary(variable_get('forum_nav_vocabulary', ''));
$title = $vocabulary->name;
$breadcrumb = array();
if ($tid) {
$breadcrumb[] = array('path' => 'forum', 'title' => $title);
}
if ($parents) {
$parents = array_reverse($parents);
foreach ($parents as $p) {
if ($p->tid == $tid) {
$title = $p->name;
}
else {
$breadcrumb[] = array('path' => 'forum/'. $p->tid, 'title' => $p->name);
}
}
}
drupal_set_title(check_plain($title));
$breadcrumb[] = array('path' => $_GET['q']);
menu_set_location($breadcrumb);
if (count($forums) || count($parents)) {
if (user_access('create forum topics')) {
$variables['list_item'] = l(t('Post new forum topic.'), "node/add/forum/$tid");
}
else if ($user->uid) {
$variables['list_item'] = t('You are not allowed to post a new forum topic.');
}
else {
$variables['list_item'] = t('<a href="@login">Login</a> to post a new forum topic.', array('@login' => url('user/login', drupal_get_destination())));
}
$variables['forum_list'] = theme('forum_list', $forums, $parents, $tid);
if ($tid && !in_array($tid, variable_get('forum_containers', array()))) {
$variables['forum_topic_list'] = theme('forum_topic_list', $tid, $topics, $sortby, $forum_per_page);
drupal_add_feed(url('taxonomy/term/'. $tid .'/0/feed'), 'RSS - '. $title);
}
}
else {
drupal_set_title(t('No forums defined'));
}
return _phptemplate_callback('forum_display', $variables);
}