0

i've been searching for a while now on how to show Cubepoints Points and Ranks in bbPress replies right below the user avatar and name...

Found the template file where to show the info, tho not sure this would be the correct one to grab the reply-author info, the "loop-single-reply.php" and just bellow bbp_reply_author_link(); i'm placing the output (correct me if i'm wrong), and i discovered the functions to calculate and display Cubepoints and Ranks (cp_displayPoints($user->ID); & cp_module_ranks_getRank($user->ID)), correct me if i'm wrong again ^^

The question is, since working with bbpress is way more harder then wordpress due to the lack of easy to reach documentation (like wordpress codex), how can I get the reply-author ID and display the Cubepoints and Ranks, am I in the right way? what am I missing? thank you in advance!

2 Answers 2

1

I found the solution of the problem, it goes like this:

<td class="bbp-reply-author">

        <?php do_action( 'bbp_theme_before_reply_author_details' ); ?>

        <?php bbp_reply_author_link( array( 'sep' => '<br />' ) ); ?>
        <!--Ranking -->
        <div class="bbp-ranking">
        <span class="bbp-rank"><?php echo cp_module_ranks_getRank(bbp_get_reply_author_id()); ?></span><br />
        <span class="bbp-points"><?php echo 'Reputação: '.cp_getPoints(bbp_get_reply_author_id()); ?></span>
        </div>
        <!--Ranking -->

        <?php do_action( 'bbp_theme_after_reply_author_details' ); ?>

    </td>

in loop-single-reply.php

1

I've done it before, try this:

add_action('bp_get_the_topic_post_poster_avatar', 'topic_poster_avatar');
function topic_poster_avatar($avatar) {
    preg_match_all('/user-([0-9]+)-avatar/', $avatar, $m);
    $id = $m[1][0];
    if ($count = get_user_meta($id, 'cpoints', 1))
        return $avatar . '<div class="cp-avatar-counter"><span class="number">' . $count . '</span> points</div>';
    return $avatar;
}

Hope it helps.

1
  • nope =/ but i'm guessing that's for buddypress, not bbpress =) even tho i'll try to get ideas from there, ty Commented Jun 24, 2012 at 22:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.