[wp-trac] [WordPress Trac] #33800: wp_delete_user delete the user ID 1 if an object is passed in param
WordPress Trac
noreply at wordpress.org
Thu Sep 10 09:25:40 UTC 2015
#33800: wp_delete_user delete the user ID 1 if an object is passed in param
--------------------------+------------------------------
Reporter: juliobox | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version: 2.0
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Changes (by utkarshpatel):
* keywords: has-patch =>
Comment:
If you check constructor of WP_user it expects int(user_id), Object of
WP_User '''or Object which have ID as user_id'''.
{{{
if ( $id instanceof WP_User ) {
$this->init( $id->data, $blog_id );
return;
} elseif ( is_object( $id ) ) {
$this->init( $id, $blog_id );
return;
}
}}}
So we can certainly not add a check for numeric and WP_User object only.
{{{
$user_id = wp_insert_user( $args ); // with email already in use
if ( ! $user_id instanceof WP_Error)
wp_delete_user( $user_id );
}}}
Should handle in coding itself.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33800#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list