function advanced_forum_forum_tools in Advanced Forum 7.2
Same name and namespace in other branches
- 6.2 advanced_forum.module \advanced_forum_forum_tools()
Create a drop down list of forum actions.
3 calls to advanced_forum_forum_tools()
- advanced_forum_forum_tools_content_type_render in plugins/
content_types/ forum_tools.inc - Render the content.
- advanced_forum_preprocess_views_view__advanced_forum_topic_list in includes/
theme.inc - Preprocess views forum topic list.
- _advanced_forum_preprocess_forums in includes/
advanced_forum_preprocess_forums.inc - Preprocess forum.
File
- ./
advanced_forum.module, line 1221 - Enables the look and feel of other popular forum software.
Code
function advanced_forum_forum_tools($tid = 0) {
global $user;
$options = array();
ctools_include('jump-menu');
if ($tid > 0) {
$select[url("forum/active", array(
'query' => array(
'forum[]' => $tid,
),
))] = t("View active posts in this forum");
$select[url("forum/unanswered", array(
'query' => array(
'forum[]' => $tid,
),
))] = t("View unanswered posts in this forum");
if ($user->uid) {
$select[url("forum/new", array(
'query' => array(
'forum[]' => $tid,
),
))] = t("View new posts in this forum");
}
}
else {
$select[url("forum/active")] = t("View active forum posts");
$select[url("forum/unanswered")] = t("View unanswered forum posts");
if ($user->uid) {
$select[url("forum/new")] = t("View new forum posts");
}
}
// Add mark as read to the jump list.
// This code is a little odd and needs explaining. The return value of
// the mark_as_read function is already formed HTML and so is unsuitable
// for the jump list. The function already has built in the ability
// to add to an existing $links array, which has the URL and title text
// separated. Rather than add a third method just for the jump menu, I
// reused that functionality here.
$mark_as_read = array();
advanced_forum_get_mark_read_link($tid, $mark_as_read);
if (!empty($mark_as_read['mark-read']['href'])) {
$select[url($mark_as_read['mark-read']['href'])] = $mark_as_read['mark-read']['title'];
}
$options['choose'] = t("- Forum Tools -");
// Create and return the jump menu.
$form = drupal_get_form('ctools_jump_menu', $select, $options);
return drupal_render($form);
}