function account_profile_form_validate in Account Profile 6
Validation function for the user account and profile editing form.
1 string reference to 'account_profile_form_validate'
- account_profile_form_alter in ./
account_profile.module - Implementation of hook_form_alter().
File
- ./
account_profile.module, line 116 - Account Profile module
Code
function account_profile_form_validate($form, &$form_state) {
user_module_invoke('validate', $form_state['values']['account'], $form_state['values']['_account'], $form_state['values']['_category']);
// Validate the username when: user is editing own account and can change username; or an admin user
if ($GLOBALS['user']->uid == $form['#uid'] && user_access('change own username') || user_access('administer users')) {
if ($error = user_validate_name($form_state['values']['account']['name'])) {
form_set_error('name', $error);
}
}
}