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

See #43232.
Built from https://develop.svn.wordpress.org/trunk@48313


git-svn-id: http://core.svn.wordpress.org/trunk@48082 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2020-07-05 10:57:01 +00:00
parent e0be0aef8b
commit 5b7774722e
3 changed files with 12 additions and 6 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 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;
}

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.5-alpha-48312';
$wp_version = '5.5-alpha-48313';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.