Users: in `wp_insert_user()`, when a password isn't provided and the user exists, ensure that the password isn't wiped out.

Adds unit test.

Props leewillis77.
Fixes #29880.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35582 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-11-11 22:31:26 +00:00
parent e6611c6b01
commit 9eb60905f2
2 changed files with 3 additions and 3 deletions

View File

@ -1287,7 +1287,7 @@ function wp_insert_user( $userdata ) {
}
// hashed in wp_update_user(), plaintext if called directly
$user_pass = $userdata['user_pass'];
$user_pass = ! empty( $userdata['user_pass'] ) ? $userdata['user_pass'] : $old_user_data->user_pass;
} else {
$update = false;
// Hash the password
@ -1330,7 +1330,7 @@ function wp_insert_user( $userdata ) {
*/
if ( in_array( $user_login, apply_filters( 'illegal_user_logins', array() ) ) ) {
return new WP_Error( 'illegal_user_login', __( 'Sorry, that username is not allowed.' ) );
}
}
/*
* If a nicename is provided, remove unsafe user characters before using it.

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-beta3-35617';
$wp_version = '4.4-beta3-35618';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.