• Resolved Artisantopia

    (@artisantopia)


    HI! myCred looks like it’s exactly what I’m looking for! I just have one question.

    How can I display a user’s ranking under their avatar in bbPress forums?

    For example – I’m currently using BP Groups Control plugin so I can assign an identifying group for each user and then use this function to display that under the avatar in the forums:

    /* 3 Display User identifying group role on forum topic replies*/
    
    add_action( 'bbp_theme_after_reply_author_details', 'mm_get_the_user_role_name_reply' );
    
    function mm_get_the_user_role_name_reply( )
    {
    global $bp;
    $my_post_id = get_userdata( bbp_get_reply_author( bbp_get_reply_id() ) );
    $user_id = get_post_field( 'post_author', $my_post_id );   
    
    if ( $group_id = get_usermeta( $user_id, 'bpgc_identifying' ) )
    {
    $identifying_group = new BP_Groups_Group( $group_id );
    echo '<div class="bbp-author-identifying-role id-' . sanitize_title($identifying_group->name) . '">', $identifying_group->name, '</div>' ;
    }
    }

    This image shows a mockup of what I’d like to achieve: http://bit.ly/13eDEIP (note you can see the Role being displayed using the function above). So I’d like to use the bbp_theme_after_reply_author_details hook to also display ranking, preferable with a tiny thumbnail of the image associated with the rank. It needs to identify the author of the post and show their ranking, not the currently logged in user.

    I look forward to hearing from you!

    http://wordpress.org/extend/plugins/mycred/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author myCred

    (@designbymerovingi)

    Hey Artisantopia

    Are you looking to add their ranking on the leaderboard or their rank according to the Rank add-on?

    To show a users ranking on the leaderboard you would use the mycred_rankings_position function which will return the position of the user on the leaderboard.

    i.e.

    $user_id = 1;
    echo '<div class="users-ranking">Ranking: #' . mycred_rankings_position( $user_id ) . '</div>';

    which will result in:
    Ranking: #<position>

    Else you can return the users rank and/or rank logo by using the mycred_get_users_rank function which will either return the Rank name (default) or any other part of the rank post object (i.e. post_excerpt for rank description if used).

    i.e.

    $user_id = 1;
    echo '<div class="users-rank">Rank: ' . mycred_get_users_rank( $user_id ) . '</div>';

    which will result in:
    Rank: <rank name>

    What’s the full php code for that and can you also show the featured image for that rank?

    Plugin Author myCred

    (@designbymerovingi)

    Hi dblegendz.

    The Rank “Logo” is the Rank post featured image. I have replied to your the other forum topic you posted on the subject.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Ranking displayed in bbPress forums for each topic author?’ is closed to new replies.