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.

Comments

jibbajabba’s picture

Further discussion from Drupal users can be found here.

moshe weitzman’s picture

Assigned: Unassigned » moshe weitzman

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

no javascript. adds a new cookie called 'comment_anon'

moshe weitzman’s picture

StatusFileSize
new3.62 KB

sigh.

Steven’s picture

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)

moshe weitzman’s picture

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

dries’s picture

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.

larssg’s picture

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

dries’s picture

Yes, read up on sessions in the PHP manual.

larssg’s picture

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.

gábor hojtsy’s picture

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

moshe weitzman’s picture

StatusFileSize
new3.09 KB

this time using $_SESSION as suggested by Steven

Anonymous’s picture

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.

DaveNotik’s picture

This ever make it into the code?

psicomante’s picture

i'm interested to this feature.

moshe weitzman’s picture

Assigned: moshe weitzman » Unassigned
Status: Needs review » Active
msameer’s picture

Title: Remembering anonymous user's information (name, email, home page) on anonymous comment forms » I reworked the patch
StatusFileSize
new2.56 KB

works fine here, Can someone please review it ?

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

msameer’s picture

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.

moshe weitzman’s picture

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.

msameer’s picture

StatusFileSize
new3.42 KB

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.

luperry’s picture

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.

luperry’s picture

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

cosmicdreams’s picture

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

gábor hojtsy’s picture

Project: » Drupal core
Version: » 6.x-dev
Component: usability » comment.module
Status: Active » Closed (duplicate)

Drupal 6 includes this functionality already.

mykle’s picture

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?

Sepero’s picture

Version: 5.x-dev » 6.9

"Drupal 6 includes this functionality already."
I did an anonymous post on my D6 installation and it is not remembering the username entered. Do I have to somehow enable this behavior?

oadaeh’s picture

Resetting stats.