Return WP_Error from wp_update_user() on a non-existent user, avoiding a fatal error in the process.
Merges [23210] to the 3.5 branch. props n7studios, SergeyBiryukov. fixes #22858. git-svn-id: http://core.svn.wordpress.org/branches/3.5@23211 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f5c3dee5ef
commit
6554a63504
|
@ -1452,6 +1452,8 @@ function wp_update_user($userdata) {
|
|||
|
||||
// First, get all of the original fields
|
||||
$user_obj = get_userdata( $ID );
|
||||
if ( ! $user_obj )
|
||||
return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) );
|
||||
|
||||
$user = $user_obj->to_array();
|
||||
|
||||
|
|
Loading…
Reference in New Issue