Enforce unique email addresses. Props Denis-de-Bernardy. fixes #9563

git-svn-id: https://develop.svn.wordpress.org/trunk@10990 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2009-04-17 18:43:40 +00:00
parent 77a64d69a5
commit aacf7f3f4d
1 changed files with 6 additions and 5 deletions

View File

@ -167,11 +167,12 @@ function edit_user( $user_id = 0 ) {
/* checking e-mail address */
if ( empty ( $user->user_email ) ) {
$errors->add( 'user_email', __( '<strong>ERROR</strong>: Please enter an e-mail address.' ), array( 'form-field' => 'email' ) );
} else
if (!is_email( $user->user_email ) ) {
$errors->add( 'user_email', __( "<strong>ERROR</strong>: The e-mail address isn't correct." ), array( 'form-field' => 'email' ) );
}
$errors->add( 'empty_email', __( '<strong>ERROR</strong>: Please enter an e-mail address.' ), array( 'form-field' => 'email' ) );
} elseif (!is_email( $user->user_email ) ) {
$errors->add( 'invalid_email', __( "<strong>ERROR</strong>: The e-mail address isn't correct." ), array( 'form-field' => 'email' ) );
} elseif ( ( $owner_id = email_exists($user->user_email) ) && $owner_id != $user->ID ) {
$errors->add( 'email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.'), array( 'form-field' => 'email' ) );
}
if ( $errors->get_error_codes() )
return $errors;