You are here

function profile_validate_profile in Drupal 6

Same name and namespace in other branches
  1. 4 modules/profile.module \profile_validate_profile()
  2. 5 modules/profile/profile.module \profile_validate_profile()
1 call to profile_validate_profile()
profile_user in modules/profile/profile.module
Implementation of hook_user().

File

modules/profile/profile.module, line 432
Support for configurable user profiles.

Code

function profile_validate_profile($edit, $category) {
  $result = _profile_get_fields($category);
  while ($field = db_fetch_object($result)) {
    if ($edit[$field->name]) {
      if ($field->type == 'url') {
        if (!valid_url($edit[$field->name], TRUE)) {
          form_set_error($field->name, t('The value provided for %field is not a valid URL.', array(
            '%field' => $field->title,
          )));
        }
      }
    }
    else {
      if ($field->required && !user_access('administer users')) {
        form_set_error($field->name, t('The field %field is required.', array(
          '%field' => $field->title,
        )));
      }
    }
  }
  return $edit;
}