function profile_user_form_validate in Drupal 7
Form validation handler for the user register/profile form.
See also
1 string reference to 'profile_user_form_validate'
- profile_form_alter in modules/
profile/ profile.module - Implements hook_form_alter().
File
- modules/
profile/ profile.module, line 484 - Support for configurable user profiles.
Code
function profile_user_form_validate($form, &$form_state) {
$result = _profile_get_fields($form['#user_category'], $form['#user_category'] == 'register');
foreach ($result as $field) {
if (!empty($form_state['values'][$field->name])) {
if ($field->type == 'url' && !valid_url($form_state['values'][$field->name], TRUE)) {
form_set_error($field->name, t('The value provided for %field is not a valid URL.', array(
'%field' => $field->title,
)));
}
}
elseif ($field->required && !user_access('administer users')) {
form_set_error($field->name, t('The field %field is required.', array(
'%field' => $field->title,
)));
}
}
}