Plugin Author
myCred
(@designbymerovingi)
Hi.
It all depends on where you want to show this. bbPress comes with tons of action hooks that you can use to insert custom details in forum topics, replies etc.
Once you have found the appropriate hook to use you can use the mycred_get_users_rank function to get a users rank logo, rank title, etc.
Thread Starter
Mike
(@iskon47)
Is this what I want? I know very little about code so a lot of this is very confusing to me if it’s not built-in haha.
bbp_theme_after_topic_author
Plugin Author
myCred
(@designbymerovingi)
You can use that if you feel it looks good.
Next you will need to get the topic authors ID in order to get his rank (or any other detail for that matter).
Example:
add_action( 'bbp_theme_after_topic_author', 'insert_mycred_rank_in_topic' );
function insert_mycred_rank_in_topic() {
// Always make sure myCRED installed first to prevent crashing your website
if ( ! function_exists( 'mycred' ) ) return;
// First we get the topic authors ID
$user_id = bbp_get_topic_author_id();
// Next we get the users rank
echo mycred_get_users_rank( $user_id );
// Finally we also output the logo.
echo mycred_get_users_rank( $user_id, 'logo' );
}
Just paste this into your themes functions.php file and probably adjust how the rank and rank logo are displayed (you might want to adjust their position via CSS)
Thread Starter
Mike
(@iskon47)
Great! I’ll try that code when I can 🙂