function noreqnewpass_form_alter in No Request New Password 5
Same name and namespace in other branches
- 8 noreqnewpass.module \noreqnewpass_form_alter()
- 6 noreqnewpass.module \noreqnewpass_form_alter()
- 7.2 noreqnewpass.module \noreqnewpass_form_alter()
- 7 noreqnewpass.module \noreqnewpass_form_alter()
Implementation of hook_form_alter().
File
- ./
noreqnewpass.module, line 41
Code
function noreqnewpass_form_alter($form_id, &$form) {
if ($form_id == 'user_login_block' && variable_get('noreqnewpass_disabled', true)) {
$items = array();
if (variable_get('user_register', 1)) {
$items[] = l(t('Create new account'), 'user/register', array(
'title' => t('Create a new user account.'),
));
}
$form['links'] = array(
'#value' => theme('item_list', $items),
);
}
if (($form_id == 'user_login_block' || $form_id == 'user_login') && variable_get('noreqnewpass_disabled', true)) {
$form['#validate'] = array(
'noreqnewpass_user_login_validate' => array(),
);
}
// Remove pass field from user edit form if he cant change
if ($form_id == 'user_edit' && !user_access("can change your own password")) {
unset($form['account']['pass']);
}
}