#2874 closed task (blessed) (fixed)
Improve user role listing in WordPress 4.4
Reported by: | johnbillion | Owned by: | netweb |
---|---|---|---|
Milestone: | 2.6 | Priority: | normal |
Severity: | normal | Version: | |
Component: | General - Administration | Keywords: | has-screenshots has-patch |
Cc: | johnbillion@… |
Description
In WordPress 4.4, if a user has multiple roles then all of these roles will be shown in a comma separated list on the Users admin listing screen. See https://core.trac.wordpress.org/ticket/22959.
bbPress assigns multiple roles to users, and also handles this on the Users admin listing screen. The following example code shows how bbPress can prevent the duplicate role name from appearing here, using the new get_role_list
filter:
add_filter( 'get_role_list', function( $roles, $user ) { $bbp_role = bbp_get_user_role( $user->ID ); if ( $bbp_role ) { unset( $roles[ $bbp_role ] ); } return $roles; }, 10, 2 );
Attachments (3)
Change History (17)
#2
@
9 years ago
Thank you!
Looking at the layouts, it'd make sense to not include those custom bbPress columns in WordPress >= 4.4 and use the default roles column in the user list table instead. It's clearer which roles a user has and the table works a bit better on narrower screens.
#3
@
9 years ago
- Keywords needs-screenshots added
Thanks for the patch @tharsheblows, let's try out this new keyword, needs-screenshots
;)
#4
@
9 years ago
- Keywords has-screenshots has-patch added; needs-patch needs-screenshots removed
Here you go! :) These are just under 1100px.
#5
@
9 years ago
- Cc johnbillion@… added
Might want to use version_compare()
for complete compatibility with beta versions, etc.
#6
@
9 years ago
That makes sense! I think this will correctly pick up all 4.4s and no 4.3s but let me know if that's not the way to do it. Thanks.
#7
@
8 years ago
- Keywords 2nd-opinion added
Narrow screenshots:
Left: WP /trunk & bbPress unpatched
Middle: WP /trunk & bbPress 2874.1.diff
Right: WP /trunk & John's filter from above
My one concern here is determining who actually owns each role (it was also my concern for the original upstream WordPress ticket), if a custom bbPress role Recipe contributor
was added for users of the food forum how is that differentiated from another role similarly named?
We're also not proposing removing the Change forum role to…
dropdown action
I personally like the way it has always been, which is aka the screen on the right but I'd love to hear others opinions?
#8
follow-up:
↓ 9
@
8 years ago
@netweb I like the right as well. Do you have a patch lying around, or should I work one up?
#9
in reply to:
↑ 8
@
8 years ago
- Keywords 2nd-opinion removed
Replying to thebrandonallen:
@netweb I like the right as well. Do you have a patch lying around, or should I work one up?
There is now, see 2874.2.diff
#12
@
8 years ago
- Owner set to netweb
- Resolution set to fixed
- Status changed from new to closed
In 6052:
Thanks John