You are here

function _user_import_validate_email in User Import 7.3

Same name and namespace in other branches
  1. 8 supported/user.inc \_user_import_validate_email()
  2. 5.2 supported/user.inc \_user_import_validate_email()
  3. 5 supported/user.inc \_user_import_validate_email()
  4. 6.4 supported/user.inc \_user_import_validate_email()
  5. 6.2 supported/user.inc \_user_import_validate_email()
  6. 7 supported/user.inc \_user_import_validate_email()
  7. 7.2 supported/user.inc \_user_import_validate_email()

Helper function to validate email.

Parameters

$email: The email address to validate.

$duplicates_allowed: TRUE if "Update existing users" is set to "Replace data" or "Update data" for at least one item.

1 call to _user_import_validate_email()
user_user_import_data in supported/user.inc
Implementation of hook_user_import_data().

File

supported/user.inc, line 287

Code

function _user_import_validate_email($email, $duplicates_allowed = FALSE) {
  if (empty($email)) {
    user_import_errors(t('no email'));
  }
  elseif (!valid_email_address($email)) {
    $nomail = variable_get('user_import_nomail', 'nomail');
    $domain = explode('@', $email)[1];
    if ($nomail == $domain) {
      return;
    }
    user_import_errors(t('invalid email'));
  }
  elseif (!$duplicates_allowed && _user_import_existing_uid($email)) {
    user_import_errors(t('duplicate email'));
  }
}