From 4e4c0dec851b67548fc06a7306913ccd802b721a Mon Sep 17 00:00:00 2001 From: Tristan Olive Date: Tue, 5 Nov 2013 14:32:33 -0500 Subject: [PATCH] Comment form access Don't render comment form block header if the user doesn't have access to post comments (DBOINCP-85) --- .../modules/comment_form_block/comment_form_block.module | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drupal/sites/default/boinc/modules/comment_form_block/comment_form_block.module b/drupal/sites/default/boinc/modules/comment_form_block/comment_form_block.module index 03b5b7a7bb..40154cb98c 100644 --- a/drupal/sites/default/boinc/modules/comment_form_block/comment_form_block.module +++ b/drupal/sites/default/boinc/modules/comment_form_block/comment_form_block.module @@ -15,13 +15,12 @@ function comment_form_block_block($op = 'list', $delta = 0, $edit = array()) { $block = array(); if ($delta == 'comment_form') { if (arg(0) == 'node' && is_numeric($nid = arg(1)) && !arg(2)) { + global $user; $node = node_load($nid); - if ($node->comment !== 0) { + if ($node->comment !== 0 AND user_access('post comments', $user)) { $block['subject'] = NULL; // This should be NULL otherwise there will be duplicate h2 elements. $block['content'] = '

' . t('Post new comment') . '

'; - if ($node->comment) { - $block['content'] .= drupal_get_form('comment_form', array('nid' => $nid)); - } + $block['content'] .= drupal_get_form('comment_form', array('nid' => $nid)); } } }