Make WordPress Core

Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#23057 closed enhancement (fixed)

Pass $reassign in the delete_user hook

Reported by: genkisan Owned by: SergeyBiryukov
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.5
Component: Users Keywords: has-patch commit
Focuses: Cc:


File: wp-admin\includes\user.php

In the wp_delete_user function, there are 2 do_action hooks

  • do_action('delete_user', $id);
  • do_action('deleted_user', $id);

The $reassign variable should also be passed along. We can then decide what to do when the admin delete a user by "Delete all posts" or "Attribute all posts to: XYZ".

Attachments (3)

user.php (13.3 KB) - added by genkisan 5 years ago.
user.php.patch (593 bytes) - added by genkisan 5 years ago.
23057.patch (990 bytes) - added by SergeyBiryukov 4 years ago.
Refreshed, added docs

Download all attachments as: .zip

Change History (11)

5 years ago

#1 @SergeyBiryukov
5 years ago

  • Keywords has-patch removed
  • Type changed from defect (bug) to enhancement

You can submit an actual patch rather than the entire file.

Please take a look at http://make.wordpress.org/core/handbook/submitting-a-patch/.

5 years ago

#2 @genkisan
5 years ago

  • Keywords has-patch added

Oops. Patch submitted.

#3 @danielbachhuber
4 years ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 3.9

This would be useful to me too. Co-Authors Plus is currently depending on the $_POST variable.

4 years ago

Refreshed, added docs

#4 @SergeyBiryukov
4 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 27462:

Pass $reassign parameter to 'delete_user' and 'deleted_user' actions.

props genkisan.
fixes #23057.

#5 @SergeyBiryukov
4 years ago

In 27463:

Fix docblock formatting in [27462]. see #23057.

#6 @nacin
4 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Gonna make a few adjustments to this. I'd like to normalize $reassign which can be 'novalue' or null. Let's normalize it to null for the purposes of the hook.

#7 @nacin
4 years ago

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

In 27466:

Normalize $reassign in wp_delete_user() to ensure the hooks receive consistent values.

fixes #23057.

#8 @nacin
4 years ago

In 27467:

Remove lame debugging. see #23057.

Note: See TracTickets for help on using tickets.