1. it tells you right on the topic you linked to.
2. this PHP code will help with styling a users reply by role.
function rk_show_role_classes($classes) {
$replyid = bbp_get_reply_author_id();
$bbp_role = bbp_get_user_display_role($replyid);
$classes[] = $bbp_role;
return $classes;
}
add_filter( 'bbp_get_topic_class','rk_show_role_classes' );
add_filter( 'bbp_get_reply_class','rk_show_role_classes' );
3 this plugin will help
https://wordpress.org/plugins/wp-useronline/
first change the PHP function to this, it bugged me that its not lowercase.
function rk_show_role_classes($classes) {
$replyid = bbp_get_reply_author_id();
$bbp_get_role = bbp_get_user_display_role($replyid);
$bbp_display_role = strtolower($bbp_get_role);
$classes[] = $bbp_display_role;
return $classes;
}
add_filter( 'bbp_get_topic_class','rk_show_role_classes' );
add_filter( 'bbp_get_reply_class','rk_show_role_classes' );
Thats CSS in the topic you linked to , put it anywhere you can put custom css
a child themes style.css file
a custom css plugin
this is basically what you would need in your code.
#bbpress-forums .bbp-body .moderator div.bbp-topic-content,
#bbpress-forums .bbp-body .moderator div.bbp-reply-content {
background: #f8f8f8 url(images/team-badge-head.png) top right no-repeat;
}
you will need an image in your child theme in a folder called images though for what they have.
you can test it out by just changing the background color for the users.
#bbpress-forums .bbp-body .keymaster div.bbp-topic-content,
#bbpress-forums .bbp-body .keymaster div.bbp-reply-content {
background: blue;
}
there should be classes inserted for every role
.keymaster = Keymaster
.moderator = Moderator
.participant = Participant
.guest = Guest
I have made everything, but it does not work. What do I make wrong?
link to your site so i can check the source code
I have the side timewise on xampp in the localhost mode. If you can exactly say me which files I must insert this code. Is this in the Theme a folder or in the plug-in itself?
you insert this into a child themes function.php file or a functionality plugin
function rk_show_role_classes($classes) {
$replyid = bbp_get_reply_author_id();
$bbp_get_role = bbp_get_user_display_role($replyid);
$bbp_display_role = strtolower($bbp_get_role);
$classes[] = $bbp_display_role;
return $classes;
}
add_filter( 'bbp_get_topic_class','rk_show_role_classes' );
add_filter( 'bbp_get_reply_class','rk_show_role_classes' );
this custom css you can put in your child themes style.css file or a custom css plugin.
#bbpress-forums .bbp-body .keymaster div.bbp-topic-content,
#bbpress-forums .bbp-body .keymaster div.bbp-reply-content,
#bbpress-forums .bbp-body .moderator div.bbp-topic-content,
#bbpress-forums .bbp-body .moderator div.bbp-reply-content {
background: #f8f8f8 url(images/team-member.png) top right no-repeat;
}
now for this to work exactly like the other site , you can download this image from here, by right clicking save image as, then uploading the image to your child theme in a folder called images. Make sure its named “team-member”
I have made everything. It does not work yet
explain to me where you put the code and how you did everything so i could see if you did anything wrong or not.
and also what theme are you using.
I am use Sahifa from Themeforest. I put all the codes in the Theme.
try this CSS instead.
#bbpress-forums .keymaster div.bbp-topic-content,
#bbpress-forums .keymaster div.bbp-reply-content,
#bbpress-forums .moderator div.bbp-topic-content,
#bbpress-forums .moderator div.bbp-reply-content {
background: #f8f8f8 url(images/team-member.png) top right no-repeat;
}