function _ldap_authentication_form_user_profile_form_alter in Lightweight Directory Access Protocol (LDAP) 7
Same name and namespace in other branches
- 8.2 ldap_authentication/ldap_authentication.inc \_ldap_authentication_form_user_profile_form_alter()
- 7.2 ldap_authentication/ldap_authentication.inc \_ldap_authentication_form_user_profile_form_alter()
1 call to _ldap_authentication_form_user_profile_form_alter()
- ldap_authentication_form_user_profile_form_alter in ldap_authentication/
ldap_authentication.module - Implements hook_form_FORM_ID_alter(). for user_profile_form
File
- ldap_authentication/
ldap_authentication.inc, line 100 - ldap_authn provides authentication against ldap server.
Code
function _ldap_authentication_form_user_profile_form_alter(&$form, $form_state) {
// keep in mind admin may be editing another users profile form. don't assume current global $user
$auth_conf = ldap_authentication_get_valid_conf();
if ($auth_conf && ldap_authentication_ldap_authenticated($form['#user'])) {
if ($auth_conf->emailOption == LDAP_AUTHENTICATION_EMAIL_FIELD_REMOVE) {
$form['account']['mail']['#type'] = 'hidden';
}
elseif ($auth_conf->emailOption == LDAP_AUTHENTICATION_EMAIL_FIELD_DISABLE) {
$form['account']['mail']['#disabled'] = TRUE;
$form['account']['mail']['#description'] = t('This email address is automatically set and may not be changed.');
}
if (!ldap_authentication_show_reset_pwd($form['#user'])) {
$form['account']['current_pass']['#disabled'] = TRUE;
if ($auth_conf->ldapUserHelpLinkUrl) {
$form['account']['current_pass']['#description'] = l(t($auth_conf->ldapUserHelpLinkText), $auth_conf->ldapUserHelpLinkUrl);
}
else {
$form['account']['current_pass']['#description'] = t('The password cannot be changed using this website');
}
$form['account']['pass']['#disabled'] = TRUE;
}
}
}