Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#34655 closed enhancement (wontfix)

Allow pre-filtering of role changes on WP_User

Reported by: tellyworth Owned by: pento
Priority: normal Milestone:
Component: Users Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

It would be useful to have pre-filters for WP_User::set_role() and friends, so a plugin could monitor or block certain roles from being applied.

For example, on multisite, it may be desirable to prevent roles from being changed on certain blogs.

Attachments (2)

34655.diff (1.6 KB ) - added by tellyworth 11 years ago.
Add pre-filters to add_role(), remove_role(), set_role().
34655.2.diff (1.7 KB ) - added by pento 11 years ago.

Download all attachments as: .zip

Change History (6)

@tellyworth
11 years ago

Add pre-filters to add_role(), remove_role(), set_role().

#1 @pento
11 years ago

  • Component GeneralUsers
  • Keywords has-patch added
  • Milestone Awaiting Review4.4
  • Owner set to pento
  • Status newassigned

@pento
11 years ago

#2 @pento
11 years ago

34655.2.diff refreshes the patch to apply cleanly against trunk, makes some coding style tweaks.

In set_role(), it's possible to send an empty role, which will cause all user roles to be removed. This existing behaviour is incompatible with the short-circuit behaviour we're after.

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


11 years ago

#4 @pento
11 years ago

  • Milestone 4.4
  • Resolutionwontfix
  • Status assignedclosed

Per the Slack discussion, this isn't really the right solution.

Note: See TracTickets for help on using tickets.