-
Notifications
You must be signed in to change notification settings - Fork 38
Get the following or followers count for a user
r-a-y edited this page Apr 23, 2014
·
1 revision
This post snippet gets the following / followers count for a logged-in user:
<?php
if ( function_exists( 'bp_follow_total_follow_counts' ) ) :
$count = bp_follow_total_follow_counts();
// uncomment the next line to output the following count for the logged-in user
// echo $count['following'];
// uncomment the next line to output the followers count for the logged-in user
// echo $count['followers'];
endif;
?>
This post snippet gets the following / followers count for user ID #5:
<?php
if ( function_exists( 'bp_follow_total_follow_counts' ) ) :
$count = bp_follow_total_follow_counts( array(
// change 5 to whatever user ID you need to fetch
'user_id' => 5
) );
// uncomment the next line to output the following count for user ID 5
// echo $count['following'];
// uncomment the next line to output the followers count for user ID 5
// echo $count['followers'];
endif;
?>