1

Since we're only permitting logging in via the Drupal Admin and LDAP.

enter image description here

How might I turn off or hide these fields in the User's Edit Account (user/xx/edit) tab?

enter image description here

1 Answer 1

4

To hide the password fields on the user edit form, put this code in your custom module, which implements hook_form_FORM_ID_alter():

function YOURMODULE_form_user_profile_form_alter(&$form, &$form_state, $form_id) {
  hide($form['account']['pass']);
}

You may also want to prevent users from going to user/password page and change their passwords on that page:

function YOURMODULE_menu_alter(&$items) {
  $items['user/password']['access callback'] = 'user_access';
  $items['user/password']['access arguments'] = array('administer users');
}

One more hint, if you want to remove the links on the user login block:

function YOURMODULE_form_user_login_block_alter(&$form, &$form_state, $form_id) {
  $form['links'] = '';
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.