Index: nodecomment.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nodecomment/nodecomment.module,v
retrieving revision 1.5
diff -u -r1.5 nodecomment.module
--- nodecomment.module	25 Sep 2008 17:58:03 -0000	1.5
+++ nodecomment.module	21 Jan 2010 18:36:00 -0000
@@ -46,6 +46,13 @@
 define('COMMENT_ANONYMOUS_MUST_CONTACT', 2);
 
 /**
+ * Constants to define the display of fields in comment form.
+ */
+define('COMMENT_DISPLAY_NAME', 1);
+define('COMMENT_DISPLAY_EMAIL', 2);
+define('COMMENT_DISPLAY_HOMEPAGE', 3);
+
+/**
  * Constants to define the comment form location
  */
 define('COMMENT_FORM_SEPARATE_PAGE', 0);
@@ -134,6 +141,21 @@
       COMMENT_ANONYMOUS_MUST_CONTACT => t('Anonymous posters must leave their contact information')),
     '#description' => t('This option is enabled when anonymous users have permission to post comments on the <a href="@url">permissions page</a>.', array('@url' => url('admin/user/access'))),
   );
+  $form['posting_settings']['comment_anon_display'] = array(
+    '#type' => 'checkboxes',
+    '#title' => t('Display Fields'),
+    '#default_value' => variable_get('comment_anon_display', array(
+      COMMENT_DISPLAY_NAME => COMMENT_DISPLAY_NAME,
+      COMMENT_DISPLAY_EMAIL => COMMENT_DISPLAY_EMAIL,
+      COMMENT_DISPLAY_HOMEPAGE => COMMENT_DISPLAY_HOMEPAGE,
+    )),
+    '#options' => array(
+      COMMENT_DISPLAY_NAME => t('Display the Name Field.'),
+      COMMENT_DISPLAY_EMAIL => t('Display the Email Field.'),
+      COMMENT_DISPLAY_HOMEPAGE => t('Display the Homepage Field.'),
+    ),
+    '#description' => t('If contact information is displayed during anonymous commenting, which fields should be available.'),
+  );
   if (!user_access('post comments', user_load(array('uid' => 0)))) {
     $form['posting_settings']['comment_anonymous']['#disabled'] = TRUE;
   }
@@ -223,34 +245,53 @@
 
         $anon_meta_info = variable_get('comment_anonymous', COMMENT_ANONYMOUS_MAYNOT_CONTACT);
         if ($user->uid == 0 && ($anon_meta_info == COMMENT_ANONYMOUS_MAY_CONTACT || $anon_meta_info == COMMENT_ANONYMOUS_MUST_CONTACT)) {
-          $form['comment_info'] = array('#weight' => -10);
-          $form['comment_info']['name'] = array(
-            '#type' => 'textfield',
-            '#title' => t('Your name'),
-            '#maxlength' => 60,
-            '#size' => 30,
-            '#default_value' => $node->name ? $node->name : variable_get('anonymous', t('Anonymous')),
-            '#required' => ($anon_meta_info == COMMENT_ANONYMOUS_MUST_CONTACT)
-          );
+          $display_info = variable_get('comment_anon_display', array(
+            COMMENT_DISPLAY_NAME => COMMENT_DISPLAY_NAME,
+            COMMENT_DISPLAY_EMAIL => COMMENT_DISPLAY_EMAIL,
+            COMMENT_DISPLAY_HOMEPAGE => COMMENT_DISPLAY_HOMEPAGE,
+          ));
+          $show_info = FALSE;
+
+          if ($display_info[COMMENT_DISPLAY_NAME] == COMMENT_DISPLAY_NAME) {
+            $form['comment_info']['name'] = array(
+              '#type' => 'textfield',
+              '#title' => t('Your name'),
+              '#maxlength' => 60,
+              '#size' => 30,
+              '#default_value' => $node->name ? $node->name : variable_get('anonymous', t('Anonymous')),
+              '#required' => ($anon_meta_info == COMMENT_ANONYMOUS_MUST_CONTACT)
+            );
+            $show_info = TRUE;
+          }
 
-          $form['comment_info']['mail'] = array(
-            '#type' => 'textfield',
-            '#title' => t('E-mail'),
-            '#maxlength' => 64,
-            '#size' => 30,
-            '#default_value' => $node->mail,
-            '#description' => t('The content of this field is kept private and will not be shown publicly.'),
-            '#required' => ($anon_meta_info == COMMENT_ANONYMOUS_MUST_CONTACT)
-          );
+          if ($display_info[COMMENT_DISPLAY_EMAIL] == COMMENT_DISPLAY_EMAIL) {
+            $form['comment_info']['mail'] = array(
+              '#type' => 'textfield',
+              '#title' => t('E-mail'),
+              '#maxlength' => 64,
+              '#size' => 30,
+              '#default_value' => $node->mail,
+              '#description' => t('The content of this field is kept private and will not be shown publicly.'),
+              '#required' => ($anon_meta_info == COMMENT_ANONYMOUS_MUST_CONTACT)
+            );
+            $show_info = TRUE;
+          }
 
-          $form['comment_info']['homepage'] = array(
-            '#type' => 'textfield',
-            '#title' => t('Homepage'),
-            '#maxlength' => 255,
-            '#size' => 30,
-            '#default_value' => $node->homepage,
-            '#required' => ($anon_meta_info == COMMENT_ANONYMOUS_MUST_CONTACT)
-          );
+          if ($display_info[COMMENT_DISPLAY_HOMEPAGE] == COMMENT_DISPLAY_HOMEPAGE) {
+            $form['comment_info']['homepage'] = array(
+              '#type' => 'textfield',
+              '#title' => t('Homepage'),
+              '#maxlength' => 255,
+              '#size' => 30,
+              '#default_value' => $node->homepage,
+              '#required' => ($anon_meta_info == COMMENT_ANONYMOUS_MUST_CONTACT)
+            );
+            $show_info = TRUE;
+          }
+
+          if ($show_info) {
+            $form['comment_info']['#weight'] = -10;
+          }
         }
 
         // add in the user's sig, if any as default content
