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)
Change History (6)
#1
@
11 years ago
- Component General → Users
- Keywords has-patch added
- Milestone Awaiting Review → 4.4
- Owner set to
- Status new → assigned
#2
@
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Add pre-filters to add_role(), remove_role(), set_role().