WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #22361


Ignore:
Timestamp:
11/05/2012 06:48:25 AM (6 years ago)
Author:
johnjamesjacoby
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #22361 – Description

    initial v1  
    33If a user has multiple roles for a site (coming in bbPress 2.2) there are two places where their site role is not listed/calculated correctly:
    44
    5 * user.php
     5* user.php (via class-wp-users-list-table.php)
    66* user-edit.php
     7
     8----
    79
    810'''Details'''
    911
    1012A few places in !WordPress core assume a user can only have 1 role at a time. Because there currently is no wp_get_user_role() function, the logic to calculate a user's primary role varies in the above locations. There may be more than just this, but these are the two immediate problems.
     13
     14----
    1115
    1216'''Duplicate'''
     
    2529* Notice that user now shows: "Participant" in both "Site Role" and "Forums Role"
    2630
     31----
     32
    2733'''Solution'''
    2834
    2935The gateway to separating out !WordPress core roles from any additional roles right now is the get_editable_roles() function. Plugins that attempt to implement their own secondary roles must filter their roles out of this array to prevent overwriting the primary site role with a secondary role. Thus, intersecting a user's roles against the keys of get_editable_roles() ensures an accurate match.
    3036
     37----
     38
    3139'''Patch'''
    3240