On this page
function profile_user_form_validate
profile_user_form_validate($form, &$form_state)
Form validation handler for the user register/profile form.
See also
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)));
}
}
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!profile!profile.module/function/profile_user_form_validate/7.x