In wp_update_user(), make sure $userdata['ID'] is set before using it.
props tyxla. fixes #31097. git-svn-id: https://develop.svn.wordpress.org/trunk@31269 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
6629feb738
commit
63ee24789d
@ -1975,12 +1975,16 @@ function wp_update_user($userdata) {
|
||||
$userdata = $userdata->to_array();
|
||||
}
|
||||
|
||||
$ID = (int) $userdata['ID'];
|
||||
$ID = isset( $userdata['ID'] ) ? (int) $userdata['ID'] : 0;
|
||||
if ( ! $ID ) {
|
||||
return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) );
|
||||
}
|
||||
|
||||
// First, get all of the original fields
|
||||
$user_obj = get_userdata( $ID );
|
||||
if ( ! $user_obj )
|
||||
if ( ! $user_obj ) {
|
||||
return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) );
|
||||
}
|
||||
|
||||
$user = $user_obj->to_array();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user