WordPress.org

Make WordPress Core

Opened 16 months ago

Closed 6 weeks ago

Last modified 6 weeks 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:

Description

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 16 months ago.
user.php.patch (593 bytes) - added by genkisan 16 months ago.
23057.patch (990 bytes) - added by SergeyBiryukov 6 weeks ago.
Refreshed, added docs

Download all attachments as: .zip

Change History (11)

genkisan16 months ago

comment:1 SergeyBiryukov16 months 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/.

genkisan16 months ago

comment:2 genkisan16 months ago

  • Keywords has-patch added

Oops. Patch submitted.

comment:3 danielbachhuber6 weeks 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.

SergeyBiryukov6 weeks ago

Refreshed, added docs

comment:4 SergeyBiryukov6 weeks 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 SergeyBiryukov6 weeks ago

In 27463:

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

comment:6 nacin6 weeks 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 nacin6 weeks 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 nacin6 weeks ago

In 27467:

Remove lame debugging. see #23057.

Note: See TracTickets for help on using tickets.