[wp-trac] [WordPress Trac] #19656: wp_update_user() not compatible with cast-to-array WP_User objects
WordPress Trac
wp-trac at lists.automattic.com
Fri Dec 23 19:58:30 UTC 2011
#19656: wp_update_user() not compatible with cast-to-array WP_User objects
--------------------------+-----------------------------
Reporter: boonebgorges | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version: 3.3
Severity: normal | Keywords: has-patch
--------------------------+-----------------------------
Pre-3.3, it was possible to do something like this:
{{{
$user = get_userdata( $user_id );
$user->user_pass = 'mypass';
wp_update_user( get_object_vars( $user ) ); // or (array)$user
}}}
It doesn't work anymore, because the data required by wp_update_user() is
stored in $user->data rather than in $user. (The second line only works
because of the new and nifty magic methods.)
It would be nice to add a little backward compatibility for this method of
generating params for wp_update_user(). The attached patch is one idea -
maybe something like that, plus a _doing_it_wrong(), would be sufficient.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19656>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list