As I posted here, it is also possible to have this check on the edit username field if your permissions allows for it by adding the following to .module file. However, it doesnt do any extra checks (such as not including the existing username in the check) so it will display a "username exists" error if you choose the same username as you have already (after doing a backspace and then re-entering the same character for example). This is not a major problem for me as the page will still save even with the error in this case as you will not have really made any changes.
function username_check_form_user_profile_form_alter(&$form)
{
_username_check_load_resources();
$form['account']['name']['#field_suffix'] = '<span id="username-check-informer"> </span>';
$form['account']['name']['#suffix'] = '<div id="username-check-message"></div>';
}
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 1508198-username-check_3.patch | 1.38 KB | drnikki |
| #2 | 1508198-username-check_2.patch | 1.09 KB | drnikki |
Comments
Comment #1
drupalina commentedSo why not add an additional statement that IF the username entered is that of the current user, then display nothing.
(I would love to see this kind of functionality added.)
Comment #2
drnikki commentedAttached is a patch that checks logged in user's name & includes that code in the .module file.
Comment #3
drnikki commentedSorry, without the new line.
Comment #4
darrellduane commentedI've incorporated the requested changes here with my patch for handling the email address checking at https://drupal.org/node/764332#comment-7508191
Comment #5
darrellduane commented