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