Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#35063 closed defect (bug) (fixed)

user deletion form hook docs incorrect and could use ids of users to be deleted

Reported by: usermrpapa's profile usermrpapa Owned by: drewapicture's profile DrewAPicture
Milestone: 4.5 Priority: normal
Severity: normal Version: 4.0
Component: Users Keywords: has-patch
Focuses: docs, administration Cc:

Description

When deleting users in the wp admin, the user deletion form fires this action:

	/**
	 * Fires at the end of the delete users form prior to the confirm button.
	 *
	 * @since 4.0.0
	 *
	 * @param WP_User $current_user WP_User object for the user being deleted.
	 */
	do_action( 'delete_user_form', $current_user );

the @param docs are wrong... the $current_user is not the user object for the user being deleted - its the user doing the deletion...

which actually is kind of pointless to pass... what really needs to be passed is the list of user ids to be deleted...

purpose of this ticket and patch is to fix the docs and add another argument to the hook...

Attachments (2)

users.php.patch (603 bytes) - added by usermrpapa 7 years ago.
patch against trunk
users2.patch (1.1 KB) - added by usermrpapa 7 years ago.
updated patch

Download all attachments as: .zip

Change History (6)

@usermrpapa
7 years ago

patch against trunk

#1 @jeremyfelt
7 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release
  • Version changed from 4.4 to 4.0

Action was introduced in [28885].

Any adjustment should also be made in confirm_delete_users(), which was moved from wp-admin/network/users.php in [34025].

It would be nice if we could replace $current_user with the list of user IDs rather than add a second parameter, but that may not be possible.

#2 @usermrpapa
7 years ago

  • Keywords has-patch added; needs-patch removed

yeah, didnt replace the $current_user since might break backward compat and just added the new arg...

patch updated to include similar network change...

@usermrpapa
7 years ago

updated patch

#3 @SergeyBiryukov
7 years ago

  • Component changed from Administration to Users
  • Milestone changed from Future Release to 4.5

#4 @DrewAPicture
7 years ago

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

In 36640:

Users: Pass the array of user IDs being deleted to the delete_user_form action hook in two places.

Also updates documentation for the first parameter, $current_user, to clarify that it holds the WP_User object for the _current_ user, not the one being deleted.

Props usermrpapa.
Fixes #35063.

Note: See TracTickets for help on using tickets.