Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#21429 closed enhancement (fixed)

wp_update_user() and wp_insert_user() should accept WP_User

Reported by: ryan's profile ryan Owned by: ryan's profile ryan
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.4.1
Component: Users Keywords: has-patch
Focuses: Cc:

Description

These functions currently accept only an array of user data. This encourages using wp_update_user( get_object_vars( $user ) ). If $user happens to be a WP_User instance, this will fail since WP_User doesn't declare object vars. wp_update_user() and wp_insert_user() should accept WP_User and handle running get_object_vars() on WP_User::data.

Attachments (2)

21429.diff (4.1 KB) - added by ryan 12 years ago.
21429.2.diff (4.0 KB) - added by ryan 12 years ago.

Download all attachments as: .zip

Change History (5)

@ryan
12 years ago

@ryan
12 years ago

#1 @nacin
12 years ago

  • Keywords has-patch added

Looks good at a glance. to_array(), or maybe actually call it get_object_vars()?

#2 @ryan
12 years ago

  • Owner set to ryan
  • Resolution set to fixed
  • Status changed from new to closed

In [21496]:

Allow passing stdClass and WP_User to wp_insert_user() and wp_update_user(). Introduce WP_User::to_array(). Eliminate uses of get_object_vars() when passing to wp_*_user(). fixes #21429

Note: See TracTickets for help on using tickets.