[wp-trac] [WordPress Trac] #29880: wp_insert_user() wiping out user_pass when one isn't provided and the user exists
WordPress Trac
noreply at wordpress.org
Tue Oct 7 19:59:04 UTC 2014
#29880: wp_insert_user() wiping out user_pass when one isn't provided and the user
exists
--------------------------+-----------------------------
Reporter: cartpauj | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version: 4.0
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
This is similar to #21495 but not identical.
Passing wp_insert_user() the following for example, will cause the Users
password to be nullified if the user already exists:
{{{
array(6) {
["role"]=>
string(10) "subscriber"
["user_login"]=>
string(15) "test"
["user_email"]=>
string(15) "test at example.com"
["first_name"]=>
string(3) "John"
["last_name"]=>
string(3) "Doe"
["ID"]=>
int(123)
}
}}}
I propose changing (found here: http://cspf.co/XvqW)
{{{
$user_pass = $userdata['user_pass'];
}}}
to this or something similar
{{{
$user_pass = (isset($userdata['user_pass']) &&
!empty($userdata['user_pass']))?$userdata['user_pass']:$old_user_data->user_pass;
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29880>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list