Displaying User role beside their replies
-
This is such an obvious feature (in my opinion) so that it is clear on forums who are the admins, moderators, and members.
I decided to see if I could work out how to add it to my forums using my custom theme for bbPress 2.1.
I managed to get it to work after a bit of experimentation and many errors by adding this:
<?php
$reply_user_id = bbp_get_reply_author_id();
global $wp_roles;
$reply_user = new WP_User( $reply_user_id );
$roles = $reply_user->roles;
$role = array_shift($roles);
printf( isset($wp_roles->role_names[$role]) ? translate_user_role($wp_roles->role_names[$role] ) : false);
?>
into loop-single-reply.php.
Hope this is helpful to anyone else trying to do this.
I believe it was a feature on the standalone version of bbPress so why was it dropped on the plugin version? Is this likely to be re-added at any point?
- You must be logged in to reply to this topic.