diff --git a/wp-includes/registration-functions.php b/wp-includes/registration-functions.php index ff9db3d226..dcdd297e82 100644 --- a/wp-includes/registration-functions.php +++ b/wp-includes/registration-functions.php @@ -10,6 +10,14 @@ function username_exists( $username ) { return null; } +function email_exists( $email ) { + global $wpdb; + $email = addslashes( $email ); + $email_exists = $wpdb->get_row("SELECT user_email FROM $wpdb->users WHERE user_email = '$email'"); + if ( $email_exists) + return true; +} + function validate_username( $username ) { $name = sanitize_user($username, true); $valid = true; diff --git a/wp-register.php b/wp-register.php index 1177c12867..a51b0513d8 100644 --- a/wp-register.php +++ b/wp-register.php @@ -33,10 +33,8 @@ case 'register': if ( username_exists( $user_login ) ) $errors['user_login'] = __('ERROR: This username is already registered, please choose another one.'); - /* checking the email isn't already used by another user */ - $email_exists = $wpdb->get_row("SELECT user_email FROM $wpdb->users WHERE user_email = '$user_email'"); - if ( $email_exists) - die (__('ERROR: This email address is already registered, please supply another.')); + if ( email_exists( $user_email ) ) + $errors['user_email'] = __('ERROR: This email is already registered, please choose another one.'); if ( 0 == count($errors) ) { $password = substr( md5( uniqid( microtime() ) ), 0, 7); @@ -49,7 +47,7 @@ case 'register': } if ( 0 == count($errors) ) { - + ?> @@ -101,11 +99,11 @@ default:

- +