Skip to:
Content

bbPress.org

Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#2874 closed task (blessed) (fixed)

Improve user role listing in WordPress 4.4

Reported by: johnbillion's profile johnbillion Owned by: netweb's profile 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)

2874.diff (1.9 KB) - added by tharsheblows 9 years ago.
disable custom roles columns in user list table if WP >= 4.4
2874.1.diff (2.0 KB) - added by tharsheblows 9 years ago.
add in version_compare
2874.2.diff (1.9 KB) - added by netweb 8 years ago.

Download all attachments as: .zip

Change History (17)

#1 @netweb
9 years ago

  • Milestone changed from Awaiting Review to 2.6

Thanks John

#2 @tharsheblows
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.

@tharsheblows
9 years ago

disable custom roles columns in user list table if WP >= 4.4

#3 @netweb
9 years ago

  • Keywords needs-screenshots added

Thanks for the patch @tharsheblows, let's try out this new keyword, needs-screenshots ;)

#4 @tharsheblows
9 years ago

  • Keywords has-screenshots has-patch added; needs-patch needs-screenshots removed

Here you go! :) These are just under 1100px.

https://cloudup.com/c4vITmExfGv

#5 @johnbillion
9 years ago

  • Cc johnbillion@… added

Might want to use version_compare() for complete compatibility with beta versions, etc.

#6 @tharsheblows
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.

@tharsheblows
9 years ago

add in version_compare

#7 @netweb
8 years ago

  • Keywords 2nd-opinion added

Narrow screenshots:

https://cldup.com/OFsfZi-dn7.png

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: @thebrandonallen
8 years ago

@netweb I like the right as well. Do you have a patch lying around, or should I work one up?

Last edited 8 years ago by thebrandonallen (previous) (diff)

@netweb
8 years ago

#9 in reply to: ↑ 8 @netweb
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

#11 @netweb
8 years ago

In 6051:

Introduce bbp_get_major_wp_version() function to help checking against WordPress versions

See #2874

#12 @netweb
8 years ago

  • Owner set to netweb
  • Resolution set to fixed
  • Status changed from new to closed

In 6052:

Administration: Only display bbPress users role in bbPress' "Forum Role" list

Since WordPress 4.4 users with multiple roles are displayed in WordPress' "Site Role" list, this changeset ensures bbPress' roles are only displayed under the "Forum Role" list and not duplicated in the "Site Role" list of the users list table.

Props johnbillion, tharsheblows for initial patches
Fixes #2874

#13 @johnjamesjacoby
8 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Crap. I accidentally stomped r6052.

#14 @johnjamesjacoby
8 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

Fixed again in r6057.

Last edited 8 years ago by johnjamesjacoby (previous) (diff)
Note: See TracTickets for help on using tickets.