From 9eb60905f2730f85203fb5c23e77e5db99270b85 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Wed, 11 Nov 2015 22:31:26 +0000 Subject: [PATCH] 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 --- wp-includes/user-functions.php | 4 ++-- wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-includes/user-functions.php b/wp-includes/user-functions.php index 36c245d7ae..89ee9c8574 100644 --- a/wp-includes/user-functions.php +++ b/wp-includes/user-functions.php @@ -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. diff --git a/wp-includes/version.php b/wp-includes/version.php index 5fe875cb88..bd30ee92f0 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.