Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: How do you show a member's total post count?


3sixty
Participant

@3sixty

snark, try this and let me know if it works? it is designed to count all forum topics started by the user. Because the bp_has_activities() only accepts one action type (I think), you would have to create 2 functions like this and add them together – one for new_forum_topics and one for new_forum_posts.

function get_new_forum_topic_count_by_user( $user_id ) {
$args = array(
'per_page' => 10000,
'show_hidden' => true,
'user_id' => $user_id,
'action' => 'new_forum_topic'
);

if ( bp_has_activities( $args ) ) {
global $activities_template;
$count = $activities_template->total_activity_count;
} else {
$count = 0;
}

return $count;
}

Skip to toolbar