Make WordPress Core

Opened 2 years ago

Closed 12 months ago

Last modified 12 months 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 2 years ago.
user.php.patch (593 bytes) - added by genkisan 2 years ago.
23057.patch (990 bytes) - added by SergeyBiryukov 12 months ago.
Refreshed, added docs

Download all attachments as: .zip

Change History (11)

@genkisan2 years ago

comment:1 @SergeyBiryukov2 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/.

@genkisan2 years ago

comment:2 @genkisan2 years ago

  • Keywords has-patch added

Oops. Patch submitted.

comment:3 @danielbachhuber12 months 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.

@SergeyBiryukov12 months ago

Refreshed, added docs

comment:4 @SergeyBiryukov12 months 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.

comment:5 @SergeyBiryukov12 months ago

In 27463:

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

comment:6 @nacin12 months 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.

comment:7 @nacin12 months 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.

comment:8 @nacin12 months ago

In 27467:

Remove lame debugging. see #23057.

Note: See TracTickets for help on using tickets.