Check for a WP_Error return from wp_create_user() in register_new_user().

props coffee2code.
fixes #14290.

Built from https://develop.svn.wordpress.org/trunk@25174


git-svn-id: http://core.svn.wordpress.org/trunk@25148 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-08-29 22:16:09 +00:00
parent cb154ad4f5
commit cf02025fe0
1 changed files with 1 additions and 1 deletions

View File

@ -353,7 +353,7 @@ function register_new_user( $user_login, $user_email ) {
$user_pass = wp_generate_password( 12, false);
$user_id = wp_create_user( $sanitized_user_login, $user_pass, $user_email );
if ( ! $user_id ) {
if ( ! $user_id || is_wp_error( $user_id ) ) {
$errors->add( 'registerfail', sprintf( __( '<strong>ERROR</strong>: Couldn&#8217;t register you&hellip; please contact the <a href="mailto:%s">webmaster</a> !' ), get_option( 'admin_email' ) ) );
return $errors;
}