Users: Pass the WP_User object to the wpmu_delete_user, delete_user, and deleted_user actions.

See #43232.

git-svn-id: https://develop.svn.wordpress.org/trunk@48313 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling 2020-07-05 10:55:18 +00:00
parent 2fba7f5a68
commit d0f4f20df5
2 changed files with 11 additions and 5 deletions

View File

@ -160,10 +160,12 @@ function wpmu_delete_user( $id ) {
* Fires before a user is deleted from the network.
*
* @since MU (3.0.0)
* @since 5.5.0 Added the `$user` parameter.
*
* @param int $id ID of the user about to be deleted from the network.
* @param int $id ID of the user about to be deleted from the network.
* @param WP_User $user WP_User object of the user about to be deleted from the network.
*/
do_action( 'wpmu_delete_user', $id );
do_action( 'wpmu_delete_user', $id, $user );
$blogs = get_blogs_of_user( $id );
@ -200,7 +202,7 @@ function wpmu_delete_user( $id ) {
clean_user_cache( $user );
/** This action is documented in wp-admin/includes/user.php */
do_action( 'deleted_user', $id, null );
do_action( 'deleted_user', $id, null, $user );
return true;
}

View File

@ -358,12 +358,14 @@ function wp_delete_user( $id, $reassign = null ) {
* Fires immediately before a user is deleted from the database.
*
* @since 2.0.0
* @since 5.5.0 Added the `$user` parameter.
*
* @param int $id ID of the user to delete.
* @param int|null $reassign ID of the user to reassign posts and links to.
* Default null, for no reassignment.
* @param WP_User $user WP_User object of the user to delete.
*/
do_action( 'delete_user', $id, $reassign );
do_action( 'delete_user', $id, $reassign, $user );
if ( null === $reassign ) {
$post_types_to_delete = array();
@ -435,12 +437,14 @@ function wp_delete_user( $id, $reassign = null ) {
* Fires immediately after a user is deleted from the database.
*
* @since 2.9.0
* @since 5.5.0 Added the `$user` parameter.
*
* @param int $id ID of the deleted user.
* @param int|null $reassign ID of the user to reassign posts and links to.
* Default null, for no reassignment.
* @param WP_User $user WP_User object of the deleted user.
*/
do_action( 'deleted_user', $id, $reassign );
do_action( 'deleted_user', $id, $reassign, $user );
return true;
}