Q:

Users can't use a name in comments that is equal to the username of a registred user

I have a Drupal 7.7 installation for which I'm activating comments using the standard Comments module. Everything works just fine except for a annoying quirk.
The admin username is "Christoffer", and for some reason anonymous users can not use the name "Christoffer" for their comments. If I add an additional character or change the spelling it works but it seems that an anonymous user cannot have the same name as a registred user. Can I allow it somehow?
Thanks

A:

It is not possible. The form validation handler for the comment form (comment_form_validate()) doesn't allow to the anonymous users to choose a username that has been already used by a registered user. The function contains the following code:
  elseif ($form_state['values']['is_anonymous']) {
    // Validate anonymous comment author fields (if given). If the (original)
    // author of this comment was an anonymous user, verify that no registered
    // user with this name exists.
    if ($form_state['values']['name']) {
      $query = db_select('users', 'u');
      $query->addField('u', 'uid', 'uid');
      $taken = $query
        ->condition('name', db_like($form_state['values']['name']), 'LIKE')
        ->countQuery()
        ->execute()
        ->fetchField();
      if ($taken) {
        form_set_error('name', t('The name you used belongs to a registered user.'));
      }
    }

The code avoid the confusion there could be between anonymous users that reports the link to 
their homepage and an authenticated user, when the anonymous users would use a username already in use.
To remove that limitation (which I don't think it's a good idea), you should implement hook_form_comment_form_alter() to add your own validation handler (with $form['#validate'][] = 'mymodule_comment_form_validate', or similar code. Your form validation handler should be a copy of the one used from the Comment module, except the part that reports an error when an authenticated user is already using that username.
There is another problem, though; the form validation handler used by the Comment module contains the following code:
  if (!empty($form_state['values']['cid'])) {
    // Verify the name in case it is being changed from being anonymous.
    $account = user_load_by_name($form_state['values']['name']);
    $form_state['values']['uid'] = $account ? $account->uid : 0;
    // …
  }

In your case, if an anonymous user would use "Christoffer" as username, and that is already used by an authenticated user, the code would load the user object for the authenticated user, and the comment would be attributed to the authenticated user, not the anonymous user.
There could be also other code in the Comment module that takes the assumption there cannot be two users with the same username, which is a restriction present in Drupal.

