I was experimenting with allowing anonymous users to comment, but when I do there is no option for authenticated users to Sign In.

So If I am an authenticated user and I"m not signed in, and I go to comment, somewhere there I'd like to have an option to sign in rather than post anonymously. But that option is not there? Meanwhile if I fill in my authenticated username for the anonymous post it will pop up as an error and say this user is registered, but again, no option to actually sign in.

I have hidden the regular user sign in for most pages, but do want it to appear when an authenticated user goes to comment. Meanwhile in an effort to encourage people to comment I thought I'd try the anonymous option. The easiest way around this will simply be to get rid of the Anonymous option, but I wondered if the initial problem is fixable?

Also, when I allow Anonymous comments Drupal pre-fills the "Your Name" box with "Anonymous" and I wonder how to get rid of that?

Comments

kellyllek’s picture

I really see this as a serious issue. If you open comments up to anonymous visitors (pending approval), then if an registered (authenticated) user visits the site and goes to comment, they have no option to "sign-in" to make that comment. In fact they would fill out their comment and go to post, and Drupal comes back with an error saying "The name you used belongs to a registered user". But again, no option to sign on.

Added to this, the error only shows if yo put in the same user name as a registered user. Same email but different user name; the comment will go through.

Is there a way to change the error message include using the same email as a registered user, and make it say, "Registered uses please sign in to post"? But even if I could do that the should be an option for registered users to sign as they post a comment, not after it has already come back as an error. That is the real issues that's wrong here. Should this be reported as a 'bug'? I know I've seen this option to sign in on other blog sites.

Put simply, There needs to be an option for registered users to sign in as they go to add a comment, while still allowing anonymous users to post.

This bounty is at my discretion as there might not be an answer here, but a good explanation and suggestion will do and I'll pay $5 paypal to the first informative response. My original query has been up for 5 days with no response, so the bounty seems to be the only sure way of getting a timely answer. (though this might mean it should move to the paid services category?)

Tom Ash’s picture

Here's what I've found after trawling through the relevant documentation (which could stand to be clearer!) and a little experimentation on a test install:

This behaviour comes from the following lines in the comment_validate function in comment.module:

 if ($edit['name']) {
        $taken = db_result(db_query("SELECT COUNT(uid) FROM {users} WHERE LOWER(name) = '%s'", $edit['name']));

        if ($taken != 0) {
          form_set_error('name', t('The name you used belongs to a registered user.'));
        }

      } 

Commenting these lines out solves the problem, although you will have to do that each time you upgrade Drupal - if you could do the same thing in a module that module would persist through your upgrades, but unfortunately the only function I can find which lets modules interfere with comment-validation is hook_comment and that doesn't appear to let you *override* the existing validation in a way which would let you do so in a module.

Tom Ash’s picture

When you comment those lines out, be sure to also comment out the 'else' after them, so the next line begins with 'if' rather than 'else if'.

Also, I see you wanted to replace rather than remove the message - if so, just replace the 'The name you used belongs to a registered user.' string in the above code. Let me know if this counts as an informative response!