Remembering anonymous user's information (name, email, home page) on anonymous comment forms

jibbajabba - November 26, 2004 - 12:58
Project:Drupal
Version:5.x-dev
Component:comment.module
Category:feature request
Priority:normal
Assigned:Unassigned
Status:duplicate
Description

The new fields for Name, Email and Home Page in anonymous comments is a welcome addition. However, the absence of a "Remember me" function forces users to enter this information repeatedly with each comment they wish to enter on a Drupal system.. Users of MT have long had the ability to click a "Remember me" checkbox so that each time they return to a site, their Name, Email and Homepage address are automatically filled into the comment form. The MT method used JavaScript to set a cookie that is read back into the form inputs. Providing a checkbox to set a cookie and remember the user's information should be a requirement for anonymous comments to allow them to bypass this step upon return.

In a usability analysis, this issue would fall under the "Flexibility and efficiency of use" category.

#1

jibbajabba - November 26, 2004 - 13:00

Further discussion from Drupal users can be found here.

#2

moshe weitzman - December 3, 2004 - 04:44
Assigned to:Anonymous» moshe weitzman

patch attached ... and i don't even approve of anonymous commenting :)

no javascript. adds a new cookie called 'comment_anon'

#3

moshe weitzman - December 3, 2004 - 04:45

sigh.

AttachmentSize
dranon_comment.patch 3.62 KB

#4

Steven - December 3, 2004 - 05:11

Can't this be done in a cleaner fashion using $_SESSION? Just something like:

if (!isset($_SESSION['comment_anon'])) {
$_SESSION['comment_anon'] = array('name' => ..., 'email' => ... ,...);
}

and

$edit = array_merge($_SESSION['comment_anon'], $edit);
(values in $edit will overwrite values in $_SESSION)

#5

moshe weitzman - December 3, 2004 - 05:16

hmmm. that seems like a good idea. by default, how long does the session cookie persist?

#6

Dries - December 3, 2004 - 07:27

We should use sessions. Sessions are cookies-made-easy. They persist as long they are configured to persist. With Drupal's default .htaccess file that is 3 months.

#7

larssg - December 3, 2004 - 07:46

I was under the impression that sessions persist until the browser window is closed. Am I missing something here?

#8

Dries - December 3, 2004 - 08:08

Yes, read up on sessions in the PHP manual.

#9

larssg - December 3, 2004 - 09:14

Okay, then. I can see that sessions can be made to persist across browser sessions. But you do this through .htaccess which does not work on IIS and some Apache servers are configured to ignore .htaccess.

My point is, using cookies as in the original patch would make this work without tinkering with the webserver and without requiring .htaccess-files to be enabled.

I do agree, though, that using sessions would make the code cleaner.

#10

Gábor Hojtsy - December 3, 2004 - 10:58

Please use sessions, user info shoul not be stored in cookies...

#11

moshe weitzman - December 3, 2004 - 23:08

this time using $_SESSION as suggested by Steven

AttachmentSize
drqhist.patch 3.09 KB

#12

Anonymous - December 4, 2004 - 12:30

How does this work exactly? I installed the patch and when adding an anonymous comment (logged out) don't see a "Remember me" checkbox and my info isn't saved.

#13

DaveNotik - December 15, 2005 - 00:30

This ever make it into the code?

#14

Psicomante - December 27, 2005 - 15:53

i'm interested to this feature.

#15

moshe weitzman - December 27, 2005 - 17:14
Assigned to:moshe weitzman» Anonymous
Status:needs review» active

#16

msameer - March 2, 2006 - 12:38
Title:Remembering anonymous user's information (name, email, home page) on anonymous comment forms» I reworked the patch

works fine here, Can someone please review it ?

It's against 4.6 and I'm welling to port it to 4.7 CVS.

AttachmentSize
drupal-comment.module-rememberme.diff 2.56 KB

#17

msameer - March 2, 2006 - 12:41
Title:I reworked the patch» Remembering anonymous user's information (name, email, home page) on anonymous comment forms

Sorry, I broke the title by mistake.

#18

moshe weitzman - March 2, 2006 - 15:20
Title: Remembering anonymous user's information (name, email, home page) on anonymous comment forms» Remembering anonymous user's information (name, email, home page) on anonymous comment forms

diff looks good. note that braces should appear on the same line as if().

please do port to HEAD. note that the form api has landed there and the patch will be quite different.

#19

msameer - March 3, 2006 - 00:51

Right on!
Sorry for the braces and I hope I didn't break anything else.

I've tested the patch on my local installation and it worked fine.

AttachmentSize
drupal-comment.module-rememberme-4.7.diff 3.42 KB

#20

luperry - May 19, 2006 - 05:37

I just patched my comment module using the 4.7 patch. and I'm getting this warning:

warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/.doublestuff/luperry/luperry.com/modules/comment.module on line 887.

#21

luperry - May 19, 2006 - 09:50

adding a settype($_SESSION['comment_anon'], 'array'); just before the line seems fixed the problem.

#22

cosmicdreams - October 24, 2007 - 14:04

Just thought I'd touch on this issue. What has changed on this since last comment?

#23

Gábor Hojtsy - October 24, 2007 - 14:06
Project:User experience» Drupal
Version:<none>» 6.x-dev
Component:usability» comment.module
Status:active» duplicate

Drupal 6 includes this functionality already.

#24

mykle - November 13, 2007 - 20:41
Version:6.x-dev» 5.x-dev

i need this feature too, but i'm in drupal 5. what would it take to port this patch?

 
 

Drupal is a registered trademark of Dries Buytaert.