Certain comment settings result in un-usable comment form

billturner - December 13, 2005 - 23:24
Project:Drupal
Version:4.7.0-beta1
Component:comment.module
Category:bug report
Priority:critical
Assigned:billturner
Status:closed
Description

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.

#1

billturner - December 13, 2005 - 23:27

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.

#2

billturner - December 14, 2005 - 05:37
Assigned to:Anonymous» billturner
Status:active» patch (code needs review)

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.

AttachmentSize
bad_form.patch1.2 KB

#3

billturner - December 14, 2005 - 05:56

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.

AttachmentSize
comment.module_39.patch1.37 KB

#4

billturner - December 14, 2005 - 22:33
Status:patch (code needs review)» patch (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.

#5

Morbus Iff - December 14, 2005 - 22:57
Status:patch (reviewed & tested by the community)» patch (code 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! :)

#6

billturner - December 14, 2005 - 23:39
Status:patch (code needs work)» patch (reviewed & tested by the community)

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

AttachmentSize
comment.module_40.patch1.39 KB

#7

Dries - December 15, 2005 - 16:31
Status:patch (reviewed & tested by the community)» fixed

Committed to HEAD. Thanks.

#8

Anonymous - December 29, 2005 - 16:41
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.