[wp-trac] [WordPress Trac] #54164: Consistently fire user role hooks

WordPress Trac noreply at wordpress.org
Sun Mar 6 16:09:21 UTC 2022

#54164: Consistently fire user role hooks
 Reporter:  dd32         |       Owner:  SergeyBiryukov
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:  6.0
Component:  Users        |     Version:  4.3
 Severity:  normal       |  Resolution:  fixed
 Keywords:  has-patch    |     Focuses:
Changes (by SergeyBiryukov):

 * owner:  (none) => SergeyBiryukov
 * status:  new => closed
 * resolution:   => fixed


 In [changeset:"52823" 52823]:
 #!CommitTicketReference repository="" revision="52823"
 Users: Bring some consistency to user role hooks.

 This standardizes the actions that one needs to hook to for tracking user
 role changes:

 * `add_user_role` is only fired when the user has actually gained a new
 * `remove_user_role` is only fired when the role was actually removed.

 Both actions are now fired in `WP_User::set_role()` as appropriate.

 Props dd32, SergeyBiryukov.
 Fixes #54164.

Ticket URL: <https://core.trac.wordpress.org/ticket/54164#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list