Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 8 years ago

#32060 closed enhancement (fixed)

Add actions for add_role() and remove_role()

Reported by: danielbachhuber's profile danielbachhuber Owned by: shooper's profile shooper
Milestone: 4.3 Priority: normal
Severity: normal Version:
Component: Role/Capability Keywords: good-first-bug has-patch commit
Focuses: Cc:

Description

set_user_role() has an action which is nice for audit purposes. It would be great if add_role() and remove_role() had similar actions to make sure there aren't any leaky spots in the audit log.

Attachments (2)

32060.diff (988 bytes) - added by shooper 10 years ago.
32060.2.diff (1.0 KB) - added by DrewAPicture 10 years ago.

Download all attachments as: .zip

Change History (11)

@shooper
10 years ago

#1 @shooper
10 years ago

  • Keywords has-patch added

Thanks for submitting this Daniel. It's something that was bothering me too. I've created the patch for it.

This ticket was mentioned in Slack in #core by shooper. View the logs.


10 years ago

#3 @SergeyBiryukov
10 years ago

  • Focuses docs added
  • Milestone changed from Future Release to 4.3

#4 @obenland
10 years ago

  • Owner set to SergeyBiryukov
  • Status changed from new to assigned

#5 @DrewAPicture
10 years ago

  • Focuses docs removed
  • Keywords commit added
  • Owner changed from SergeyBiryukov to shooper

32060.2.diff adjusts the hook docs syntax and adds @since versions for 4.3.

#6 @nacin
10 years ago

All hooks in WordPress with the word "added" or "deleted" use it as a prefix, not a suffix. Verb + noun is pretty common for us. I'm going to change this to added_user_role and removed_user_role.

#7 @nacin
10 years ago

Consistency!

  • I was going to change $this->id to $this, but set_user_role uses $this->id.
  • I was going to change these to added_user_role and removed_user_role, but to match set_user_role, I'm going to go with add_user_role and remove_user_role instead.

#8 @nacin
10 years ago

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

In 32771:

Add add_user_role and remove_user_role actions for WP_User::add_role() and remove_role().

props shooper.
fixes #32060.

This ticket was mentioned in Slack in #meta by sergey. View the logs.


8 years ago

Note: See TracTickets for help on using tickets.