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

git-svn-id: http://svn.automattic.com/wordpress/trunk@10990 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-04-17 18:43:40 +00:00
parent 5275d71c22
commit 05666ec7bc
1 changed files with 6 additions and 5 deletions

View File

@ -167,10 +167,11 @@ 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() )