Drupal patch monkey, Remember me for anonymous comments.

Body

Obsolete. Read this
Yet another patch. Now you don't have to retype all the fields anymore, Just check the "Remember me" button.

The patch is here

--- comment.module- 2006-03-02 13:06:12.000000000 +0200
+++ comment.module 2006-03-02 14:29:55.000000000 +0200
@@ -368,6 +368,22 @@
   }
}

+function comment_comment($op, $comment) {
+  if (($op == 'update') || ($op == 'insert'))
+    {
+      if ($comment['remember'])
+ {
+   $fields = array('name', 'mail', 'homepage', 'remember');
+   foreach ($fields as $field) {
+     $_SESSION['comment_anon'][$field] = $comment[$field];
+   }
+ }
+      else {
+ unset($_SESSION['comment_anon']);
+      }
+    }
+}
+
function comment_reply($nid, $pid = NULL) {
   // set the breadcrumb trail
   $node = node_load(array('nid' => $nid));
@@ -412,7 +428,7 @@
       $output .= theme('box', t('Reply'), t("This discussion is closed: you can't post new comments."));
     }
     else if (user_access('post comments')) {
-      $output .= theme('comment_form', array('pid' => $pid, 'nid' => $nid), t('Reply'));
+      $output .= theme('comment_form', array_merge($_SESSION['comment_anon'], array('pid' => $pid, 'nid' => $nid)), t('Reply'));
     }
     else {
       $output .= theme('box', t('Reply'), t('You are not authorized to post comments.'));
@@ -905,7 +921,7 @@

     // If enabled, show new comment form.
     if (user_access('post comments') && node_comment_mode($nid) == 2 && variable_get('comment_form_location', 0)) {
-      $output .= theme('comment_form', array('nid' => $nid), t('Post new comment'));
+      $output .= theme('comment_form', array_merge($_SESSION['comment_anon'], array('nid' => $nid)), t('Post new comment'));
     }
   }
   return $output;
@@ -1393,11 +1409,13 @@
     $form .= form_textfield(t('Your name'), 'name', $edit['name'] ? $edit['name'] : variable_get('anonymous', 'Anonymous') , 20, 60);
     $form .= form_textfield(t('E-mail'), 'mail', $edit['mail'], 20, 64, t('The content of this field is kept private and will not be shown publicly.'));
     $form .= form_textfield(t('Homepage'), 'homepage', $edit['homepage'], 20, 255);
+    $form .= form_checkbox(t('Remember me'), 'remember', 1, $edit['remember']);
   }
   else if (variable_get('comment_anonymous', 0) == 2) {
     $form .= form_textfield(t('Your name'), 'name', $edit['name'] ? $edit['name'] : variable_get('anonymous', 'Anonymous') , 20, 60, NULL, NULL, TRUE);
     $form .= form_textfield(t('E-mail'), 'mail', $edit['mail'], 20, 64, t('The content of this field is kept private and will not be shown publicly.'), NULL, TRUE);
     $form .= form_textfield(t('Homepage'), 'homepage', $edit['homepage'], 20, 255);
+    $form .= form_checkbox(t('Remember me'), 'remember', 1, $edit['remember']);
   }

   // subject field:

I'll apply it to foolab soon ;-)

Add new comment

The content of this field is kept private and will not be shown publicly.