WordPress.org

Ready to get started?Download WordPress

Forums

myCRED
[resolved] Adding Points & Rank to bbPress' User Postbit (15 posts)

  1. Nykess
    Member
    Posted 1 year ago #

    Hi,

    (Me again.)

    How can I add Points & Rank under bbPress' user roles (e.g. Keymaster).

    After the user role (in this case, Keymaster), I want for it to do this:

    Points:
    Rank:

    Thanks!

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

  2. Gabriel
    Member
    Plugin Author

    Posted 1 year ago #

    Not sure I understand where exactly you want to include these details. You have to forgive me but I am not that well versed with bbPress. Is it in the admin area or alongside topics and replies? A screenshot always helps! :)

  3. Nykess
    Member
    Posted 1 year ago #

    Hi Gabriel,

    I have included a screenshot of where I would like for this information to appear:
    http://img546.imageshack.us/img546/8953/wep6.jpg

    Thanks!

  4. Gabriel
    Member
    Plugin Author

    Posted 1 year ago #

    Have you selected "Show users points balance in replies" on the myCRED > Hooks page for bbPress?

  5. Nykess
    Member
    Posted 1 year ago #

    Didn't even see that option; it was really hidden. Thank you!

    How can I put the "Ranks" just under that?

  6. Gabriel
    Member
    Plugin Author

    Posted 1 year ago #

    You need to use the 'bbp_theme_after_reply_author_details' action hook.

    add_action( 'bbp_theme_after_reply_author_details', 'add_rank_in_author_details' );
    function add_rank_in_author_details()
    {
    	$reply_id = bbp_get_reply_id();
    	if ( bbp_is_reply_anonymous( $reply_id ) ) return;
    	$user_id = bbp_get_reply_author_id( $reply_id );
    	if ( mycred_exclude_user( $user_id ) ) return;
    	echo 'Rank: ' . mycred_get_users_rank( $user_id );
    }
  7. Nykess
    Member
    Posted 1 year ago #

    Can you please specify where this should be added? I don't know much about adding hooks.

    Thank you.

  8. Gabriel
    Member
    Plugin Author

    Posted 1 year ago #

    All code goes in your themes functions.php file.

  9. George
    Member
    Posted 9 months ago #

    The last part of this doesn't work. When I add:

    add_action( 'bbp_theme_after_reply_author_details', 'add_rank_in_author_details' );
    function add_rank_in_author_details()
    {
    	$reply_id = bbp_get_reply_id();
    	if ( bbp_is_reply_anonymous( $reply_id ) ) return;
    	$user_id = bbp_get_reply_author_id( $reply_id );
    	if ( mycred_exclude_user( $user_id ) ) return;
    	echo 'Rank: ' . mycred_get_users_rank( $user_id );
    }

    All that happens is that the reply topic is echo'ed .. not the user's rank.

  10. Gabriel
    Member
    Plugin Author

    Posted 9 months ago #

    @George How many ranks do you have setup? Try this: Go to myCRED > Settings > Management and click "Assign Ranks to Users" to see if that resolves the issue.

  11. George
    Member
    Posted 9 months ago #

    On my bbpress forum posts, the rank displays as: Member
    On my buddypress, the user's username is displayed as the rank.

    See example here: http://oi39.tinypic.com/aytwma.jpg

  12. George
    Member
    Posted 9 months ago #

    We have 5 ranks.
    I assigned ranks to users, no luck.

  13. soufianesabiri
    Member
    Posted 4 months ago #

    THANKS Gabriel for the awesome code, it worked like a charm !

  14. vinaunder
    Member
    Posted 4 months ago #

    @Gabriel I wonder how I can put the rank of my forum below of the use nickname - http://puu.sh/8h8Dv.jpg

  15. Gabriel
    Member
    Plugin Author

    Posted 4 months ago #

    @vinaunder - The above code will insert the rank after the users avatar and username.
    You might want to use some CSS styling to move the rank in the desired position. Otherwise check your bbPress template files to see what other positions you could use to insert the rank. bbPress comes with tons of useful action hooks for these type of scenarios.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.