[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 22:34:08 UTC 2011


#19656: wp_update_user() not compatible with cast-to-array WP_User objects
--------------------------+-------------------------
 Reporter:  boonebgorges  |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Users         |     Version:  3.3
 Severity:  normal        |  Resolution:  worksforme
 Keywords:  has-patch     |
--------------------------+-------------------------
Changes (by scribu):

 * status:  new => closed
 * resolution:   => worksforme
 * milestone:  Awaiting Review =>


Comment:

 Actually, passing all of the user fields isn't necessary. It's better to
 pass only the values that you want to update:

 {{{
 $to_update = array(
   'ID' => $user_id,
   'user_pass' => 'mypass'
 );

 wp_update_user( $to_update );
 }}}

 This should work fine in both WP 3.2 and WP 3.3.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19656#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list