How to Show bbPress User Role on BP Profile Page?
-
Hello to all the BuddyPress Scientists out there.
I am almost mad about to show bbPress User Role on BuddyPress Profile Page. And I am currently using this code, but it is not perfect and correct.
function show_user_role () { global $bp; $reply_id = bbp_get_reply_id( $reply_id ); $abc_role = bbp_get_user_display_role( bbp_get_reply_author_id( $reply_id ) ); echo '<span class="profile-role ' . $abc_role . '"><i class="fa fa-star"></i> <em>'; echo $abc_role; echo '</em></span>'; } add_action( 'bp_before_member_header_meta', 'show_user_role' );
The demo output can be seen on http://www.punjabi.cc/ website by visiting any members profile.
First problem with this code is, it does not show correct name for dynamic roles when user is not logged in.
Second problem, the users who are blocked also tagged ‘Member’ not ‘Blocked’.
Please either correct it or provide me a another perfect piece of code, I will be highly thankful.
Regards,
Laddi
- The topic ‘How to Show bbPress User Role on BP Profile Page?’ is closed to new replies.