2

There's a function to call cubepoints points for buddypress under groups topic.php posted by a good friend on stackoverflow here:

 add_filter('bp_get_the_topic_time_since_last_post','bp_forum_extras_get_the_topic_time_since_last_post');

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"><center><span class="number">' . $count . '</span> Points</center></div>';
return $avatar;

}

I wanted to know if you knew the function to call cubepoints ranks as a function for buddypress? The code below is used for BB press not buddypress. cp_module_ranks_getRank should be used to call cubepoints rank but how would I make that into a function like above?

<?php echo cp_module_ranks_getRank( bp_displayed_user_id() ); ?>

1 Answers1

0

If we don't know where you want to call it, we can't suggest a hook or filter.

I'm guessing you want it in the BP members loop ? If so, look at the do_action hooks in that template, write a function and return the results of cp_module_ranks_getRank( bp_get_member_user_id() ).

shanebp
  • 1,904
  • 3
  • 17
  • 28
  • Tried this -> add_filter('bp_get_the_topic_time_since_last_post','bp_forum_extras_get_the_topi‌​c_time_since_last_post'); 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 . if(function_exists('cp_module_ranks_getRank')) && $user->ID){ echo '
    '.cp_module_ranks_getRank($count).'‌​
    '; return $avatar; }
    – Michael Murphy Oct 10 '13 at 19:48