Hey there. You’ll need to write a small plugin to do this, as currently there is no classification of what roles a user has available to target.
I’ve created this Trac ticket and slated it for the 2.7 release. It won’t be too difficult for us to make this easier for you in a future release.
https://bbpress.trac.wordpress.org/ticket/2737
@johnjamesjacoby Awesome, thank you! One thing I’d like to mention is that ideally, I’d like this to be effective site-wide. So showing up under who’s online and when you view that user’s profile.
If you don’t mind, I’m going to tag you in another topic I started.
This seem to works. Or seems to work, I never know difference.
add_filter('bbp_before_get_reply_author_role_parse_args', 'ntwb_bbpress_reply_css_role' );
function ntwb_bbpress_reply_css_role() {
$role = strtolower( bbp_get_user_display_role( bbp_get_reply_author_id( $reply_id ) ) );
$args['class'] = 'bbp-author-role bbp-author-role-' . $role;
$args['before'] = '';
$args['after'] = '';
return $args;
}
add_filter('bbp_before_get_topic_author_role_parse_args', 'ntwb_bbpress_topic_css_role' );
function ntwb_bbpress_topic_css_role() {
$role = strtolower( bbp_get_user_display_role( bbp_get_topic_author_id( $topic_id ) ) );
$args['class'] = 'bbp-author-role bbp-author-role-' . $role;
$args['before'] = '';
$args['after'] = '';
return $args;
}
I am just wondering why the trac was closed as a dupe of another, where the one it was apparently a duplicate of is something we can already achieve in bbPress.
The user is asking to be able to style the username, not the user role. There is no mention of the other ticket adding css to the user role element – so why was this ticket closed?
@geekserve
I am just wondering why the trac was closed as a dupe of another, where the one it was apparently a duplicate of is something we can already achieve in bbPress.
they both made a topic about adding a class for the bbPress author role, and you cant do it without a function if it were in core you would just need some plain CSS.
The user is asking to be able to style the username, not the user role. There is no mention of the other ticket adding css to the user role element – so why was this ticket closed?
well alot of people ask to style the user role and it might have been a mistake, but the other ticket also a person mentioning an idea to just add a body class to the author area so really you could style anything in that area by the persons user role.