[wp-trac] [WordPress Trac] #23016: Allow plugins to manipulate WP_Roles ($wp_roles global) on construct

WordPress Trac noreply at wordpress.org
Wed Nov 2 00:30:30 UTC 2016


#23016: Allow plugins to manipulate WP_Roles ($wp_roles global) on construct
-------------------------------------------------+-------------------------
 Reporter:  johnjamesjacoby                      |       Owner:  pento
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  4.7
Component:  Role/Capability                      |     Version:  3.5
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests commit      |     Focuses:
  needs-dev-note                                 |
-------------------------------------------------+-------------------------
Changes (by pento):

 * status:  accepted => closed
 * resolution:   => fixed


Comment:

 In [changeset:"39082"]:
 {{{
 #!CommitTicketReference repository="" revision="39082"
 Roles/Capabilities: Add a new `wp_roles_init` filter.

 Historically, it's been difficult to extend user roles, but reasonable to
 work around by waiting until after `init` has fired, to add custom roles
 and capabilities. With the addition of Locale Switching, Core now
 potentially loads roles before `init` has fired, leaving a window where
 custom roles and capabilities are not handled.

 The new filter allows plugins to add their own custom roles whenever
 they're initialised (on page load, or when switching sites, for example),
 so that they can always be obeyed.

 `WP_Roles` has also been tidied up a little bit, to remove duplicate code.

 Props johnjamesjacoby, pento.
 Fixes #23016.
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/23016#comment:24>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list