function profile_user_form_validate

Form validation handler for the user register/profile form.

See also

profile_form_alter()

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

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,
            )));
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.