Incorrect forum links for unprivileged users

Don't show quote links for users who cannot post;
Cleaned up forum node links

(DBOINCP-85)
This commit is contained in:
Tristan Olive 2013-11-05 16:05:19 -05:00
parent 4e4c0dec85
commit 7ba36ed04c
1 changed files with 18 additions and 11 deletions

View File

@ -240,8 +240,13 @@ function boinc_preprocess_node_forum(&$vars, $hook) {
//$vars['node']->links = array();
}
// Move the new comment link to the end
$vars['node']->links['reply'] = $vars['node']->links['comment_add'];
unset($vars['node']->links['comment_add']);
if (user_access('post comments')) {
$vars['node']->links['reply'] = $vars['node']->links['comment_add'];
unset($vars['node']->links['comment_add']);
}
else {
unset($vars['node']->links['comment_forbidden']);
}
$vars['links'] = theme_links($vars['node']->links, array('class' => 'links inline'));
$vars['moderator_links'] = theme_links($vars['moderator_links']);
}
@ -336,15 +341,17 @@ function boinc_preprocess_comment(&$vars, $hook) {
}
else {
$links = comment_links($vars['comment'], FALSE);
$links['comment_quote'] = array(
'title' => t('Quote'),
'href' => "comment/reply/{$nid}/{$cid}",
'attributes' => array(
'title' => t('Reply to this comment with quote'),
),
'fragment' => 'comment-form',
'query' => 'quote=1',
);
if (user_access('post comments')) {
$links['comment_quote'] = array(
'title' => t('Quote'),
'href' => "comment/reply/{$nid}/{$cid}",
'attributes' => array(
'title' => t('Reply to this comment with quote'),
),
'fragment' => 'comment-form',
'query' => 'quote=1',
);
}
}
ksort($links);
$vars['links'] = theme_links($links);