[wp-trac] [WordPress Trac] #53199: WP_User::add_role() runs even if the added role is already set
WordPress Trac
noreply at wordpress.org
Thu May 13 13:36:01 UTC 2021
#53199: WP_User::add_role() runs even if the added role is already set
-------------------------------------+------------------------------
Reporter: bhujagendra | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version: 2.0
Severity: normal | Resolution:
Keywords: needs-patch 2nd-opinion | Focuses:
-------------------------------------+------------------------------
Changes (by desrosj):
* keywords: => needs-patch 2nd-opinion
* version: trunk => 2.0
Comment:
Hey @bhujagendra,
Welcome to Trac! Thanks for this ticket.
This seems sensible to me! I'd like to allow for more feedback just in
case there's something I'm missing.
The only backwards compatibility issue I can think of would be if a plugin
or theme depends on `add_user_role` firing every time. But that seems
super edge case to me. This is a reasonable correction, though, and we
could make sure to mention it in developer notes before a release.
I'm not totally sold on the need for a new filter, but I can see some
potential use cases. That said, I think `pre_add_user_role` would better
fit the naming convention found elsewhere in Core. An equivalent on in
`remove_role()` should also be introduced if it's decided to add one.
Changing the Version to 2.0, as that's when `WP_User->add_role()` was
introduced, and it's been mostly unchanged since. In Trac, Version is the
first version of WordPress affected by an issue.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53199#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list