From 7ba36ed04c7c7f282ef9d7b4f5e3a5c5770b128a Mon Sep 17 00:00:00 2001 From: Tristan Olive Date: Tue, 5 Nov 2013 16:05:19 -0500 Subject: [PATCH] Incorrect forum links for unprivileged users Don't show quote links for users who cannot post; Cleaned up forum node links (DBOINCP-85) --- .../default/boinc/themes/boinc/template.php | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/drupal/sites/default/boinc/themes/boinc/template.php b/drupal/sites/default/boinc/themes/boinc/template.php index 40ceaad6b1..ca10f00894 100644 --- a/drupal/sites/default/boinc/themes/boinc/template.php +++ b/drupal/sites/default/boinc/themes/boinc/template.php @@ -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);