Make WordPress Core

Opened 22 months ago

Closed 22 months ago

Last modified 22 months ago

#49361 closed enhancement (fixed)

Add $reassign to "remove_user_from_blog" - hook.

Reported by: Tivus Owned by: SergeyBiryukov
Milestone: 5.4 Priority: normal
Severity: minor Version:
Component: Users Keywords: 2nd-opinion needs-patch dev-feedback
Focuses: administration, multisite Cc:


When a user is deleted in a multisite all her content can be reassigned to another user. The function remove_user_from_blog is triggered with three parameters ( $user_id
, $blog_id = '', $reassign = '').
The action "remove_user_from_blog" is triggered a few lines below but does not pass the value of reassign:
do_action( 'remove_user_from_blog', $user_id, $blog_id );
For more context: https://github.com/WordPress/WordPress/blob/master/wp-includes/ms-functions.php#L254
Is there any reason not to add $reassign to the action?

But why?
We are running a large network and use reference tables to keep track of user's posts. When posts are reassigned, those tables should also be updated. Currently it would be really difficult to access the value of $reassign.

Change History (4)

#1 @SergeyBiryukov
22 months ago

  • Milestone changed from Awaiting Review to 5.4
  • Owner set to SergeyBiryukov
  • Status changed from new to accepted

#2 @SergeyBiryukov
22 months ago

In 47173:

Users: In remove_user_from_blog():

  • Change default value of the $blog_id parameter to match the documented type.
  • Change the type of the $reassign parameter for consistency with $user_id and $blog_id.
  • Add documentation for the return value.

See #49361.

#3 @SergeyBiryukov
22 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 47175:

Users: Pass the $reassign parameter to the remove_user_from_blog action.

Props Tivus.
Fixes #49361.

#4 @SergeyBiryukov
22 months ago

In 47177:

Coding Standards: Fix WPCS issues in [47175].

See #49361.

Note: See TracTickets for help on using tickets.