? comment_perm_d6.patch ? comment_perm_hide_comments.patch Index: comment_perm.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/comment_perm/comment_perm.module,v retrieving revision 1.1 diff -u -p -r1.1 comment_perm.module --- comment_perm.module 4 Oct 2008 00:04:12 -0000 1.1 +++ comment_perm.module 6 Apr 2009 20:54:21 -0000 @@ -55,6 +55,13 @@ function comment_perm_admin_settings() { '#default_value' => variable_get('comment_perm_node_types', ''), '#options' => $types ); + + $form['comment_perm_hide_comments'] = array( + '#type' => 'checkbox', + '#title' => t('Hide comments entirely'), + '#default_value' => variable_get('comment_perm_hide_comments', 0), + '#description' => t('Comments will be hidden entirely. If unchecked, the messages set below will be shown instead.'), + ); $form['comment_perm_message_anon'] = array( '#type' => 'textfield', @@ -106,6 +113,19 @@ function comment_perm_comment($a1, $op) } /** + * Implementation of hook_nodeapi(). + */ +function comment_perm_nodeapi(&$node, $op, $arg = 0) { + switch ($op) { + case 'alter': + if (variable_get('comment_perm_hide_comments', 0) && !comment_perm_access($node)) { + $node->comment = COMMENT_NODE_DISABLED; + } + break; + } +} + +/** * Implementation of hook_form_alter(). */ function comment_perm_form_alter($form_id, &$form) {