Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Users can not change their own username, even if they have the 'change own username' right from the user module.
Changing the beginning of the ldapprov_form_alter function to the following will check if the user are the 'change own username' right and if the current user is the same as the one on the form.
function ldapprov_form_alter(&$form, $form_state, $form_id) {
global $user;
switch ($form_id) {
case "user_profile_form":
if ((LDAPPROV_ENABLED && user_access(LDAPPROV_PERMISSION)) ||
(user_access('change own username') && ($account = $form['_account']['#value']->uid == $user->uid))) {
// Set a custom form validate and submit handlers.
$form['#validate'][] = 'ldapprov_account_validate';
$form['#submit'][] = 'ldapprov_account_submit';
}
break;
Comments
Comment #1
batje CreditAttribution: batje commentedchanged the title to be english
Comment #2
miglius CreditAttribution: miglius commentedCommitted with a minor change, thanks!