I searched through the open bugs but didn't see this particular problem.

The Problem:
I would like anonymous (non-account users) to submit comments. So, on "Administer -> Comments -> Configure -> Posting Settings" I have the following option marked:

* Anonymous posters must leave their contact information

Then, on "Administer -> Access Control -> Comment Module" I have the following options checked under comments:

<code>
                                                    anonymous user    authenticated user
access comments	                                         X                     X
	
administer comments	      
	
post comments	                                         X                     X
	
post comments without approval                                                 X

However, when I visit the site without my user cookies (e.g. with another browser, or after logging out), the comment form looks (almost) fine, but the code underneath is jumbled. For example, it should have the "Name," "Email," "Homepage," and "Comment" form fields available, but all is shown is "E-mail," "Homepage," and "Comments." There are two problems here:

  1. The "Name" field is no longer displayed
  2. The HTML underneath the "E-mail" form field is incorrect. See code below:

Here, you can see how even though the "E-mail" label/text is displayed, the form/text field next to it is actually for the "Name" information:

<code>
<div><div class="form-item">
 <label for="edit-name">E-mail:</label><span class="form-required">*</span><br />
 <input type="text" maxlength="64" class="form-text required" name="edit[name]" id="edit-name"  size="30" value=""  />
 <div class="description">The content of this field is kept private and will not be shown publicly.</div>

If anyone tries to submit a comment with this mangled form in place, then they're given an error that the email address hasn't been filled in.

If I change the "Access Control" settings to allow anonymous comments without approval, then the form shows up correctly. So, it's only under this certain circumstance that this problem shows up.

You can see this for yourself here: http://brilliantcorners.org/comment/reply/49, where if you try and submit an anonymous comment.

Comments

billturner’s picture

Also note that this problem does not exist in 4.6.4 or 4.6.5, the versions I used before taking the leap to the 4.7.0-beta1.

The same settings I describe above will display the correct form, allowing anonymous users to comment - with all the form fields displaying correctly.

billturner’s picture

Assigned: Unassigned » billturner
Status: Active » Needs review
StatusFileSize
new1.2 KB

After taking a closer look at comments.module, I found out what the problem was. Right after this line in comments.module, there were 2 calls to create a 'name' field.

I've attached a patch (my first ever!), which will hopefully work. All that changes is a single word, but after the change, comments work again, in the settings described above.

billturner’s picture

StatusFileSize
new1.37 KB

Sorry about that last patch. I got the source from cvs and attached to this note is a better formatted patch. Please ignore the above, and use this patch instead.

billturner’s picture

Status: Needs review » Reviewed & tested by the community

I'm just setting it to "Ready to be commented" since, well, it is. It's just changing a single word/variable, but that single word/variable renders a form unusable. See note above for the patch.

morbus iff’s picture

Status: Reviewed & tested by the community » Needs work

You're off by one character - the form element is 'mail', not 'email'. See the similar (and correct) declarations just a few lines above the problem area in comment.module. Make a new patch with 'mail' instead of 'email', and you'll be golden - I can't imagine why it wouldn't be committed. Congrats on your first patch! :)

billturner’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new1.39 KB

Ack! I can't believe I let that slip in. The first patch I uploaded was correct, but the better formatted patch was wrong.

Attached is a corrected patch. Thanks for pointing out my mistake!

Cheers,
Bill

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)