You are here

function uif_uif_validate_user in User Import Framework 7

Same name and namespace in other branches
  1. 6 uif.admin.inc \uif_uif_validate_user()

Implementation of hook_uif_validate_user().

File

./uif.admin.inc, line 334
Simple, extensible user import from a CSV file.

Code

function uif_uif_validate_user($user_data, $uid, $header = NULL) {
  $errors = array();
  if (!valid_email_address($user_data['mail'])) {
    $errors[] = t('Missing or invalid email address: %mail', array(
      '%mail' => $user_data['mail'],
    ));
  }
  if (isset($user_data['name']) && empty($user_data['name'])) {
    $errors[] = t('Username is empty. Leave this column out to create a unique username based on email address.', array());
  }
  if (isset($user_data['pass']) && empty($user_data['pass'])) {
    $errors[] = t('Password is empty. Leave this column out to have an automatically generated password.', array());
  }
  if (isset($user_data['roles'])) {
    uif_parse_roles($user_data['roles'], $roles_errors);
    $errors = array_merge($errors, $roles_errors);
  }
  return $errors;
}