Skip to:
Content
Pages
Categories
Search
Top
Bottom

User ranking system?


  • jenseo
    Participant

    @jenseo

    Hi!

    I’m looking for a solution to the following:

    I would like to display a user ranking system based on the number of posts they have written in the forums.

    Take a look at the reputation indicator under the users profile photo on this forum to see what I’m looking for:

    User reputation under profile picture.

    Any ideas on how I can achieve this?

    Thanks!

    // Jens.

Viewing 9 replies - 1 through 9 (of 9 total)

  • Robin W
    Moderator

    @robin-w

    Yes, but depends on how code savvy you are.

    Basically adding this to your functions file will get a count showing

    function display_counts () 
    {
    		$post_count = bbp_get_user_post_count( bbp_get_reply_author_id( $reply_id )) ;
    		echo "<br>Total posts : " ;
    		echo $post_count ;
    		echo "</br>" ;
    		//add some if statements here eg if $post_count>100 echo 'hero' or a link to a picture
    		}
    add_action ('bbp_theme_after_reply_author_details', 'display_counts') ;
    
    

    and where I’ve indicated adding some if statements link to icons or words will do the second


    jenseo
    Participant

    @jenseo

    Awesome Robin, just what I need! Will try it out tonight!

    Thanks alot!

    // Jens.


    jenseo
    Participant

    @jenseo

    Hmm, I’m not getting any count back, it just says Posts: 0


    Robin W
    Moderator

    @robin-w

    yes just tried it, and it does say 0 – will come back to you – I just cribbed some code within a larger file that it worked several months ago – will take a closer look !


    jenseo
    Participant

    @jenseo

    Thanks Robin, I really appreciate it!
    // Jens.


    Robin W
    Moderator

    @robin-w

    Ok, not quite sure why that stopped working – it used to !

    But have just tested this :

    function display_counts () 
    {
    		
    		$user_id=bbp_get_reply_author_id( $reply_id ) ;
    		$topics  = bbp_get_user_topic_count_raw( $user_id);
    		$replies = bbp_get_user_reply_count_raw( $user_id);
    		$post_count   = (int) $topics + $replies;
    		echo "<br>Total posts : " ;
    		echo $post_count ;
    		echo "</br>" ;
    		}
    add_action ('bbp_theme_after_reply_author_details', 'display_counts') ;

    and that works.

    As before you can then add some if statements to display a status or icon


    jenseo
    Participant

    @jenseo

    Works like a charm Robin, thank you so much!

    // Jens.


    Robin W
    Moderator

    @robin-w

    Great, glad you’re fixed.

    If you do some coding for ranking, can you post this back here, and maybe I’ll add it as a plugin for others benefit


    jenseo
    Participant

    @jenseo

    Of course, no problem!

    // Jens.

Viewing 9 replies - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.