Skip to:
Content
Pages
Categories
Search
Top
Bottom

Display follower and following count

  • Avatar of Henry
    Henry
    Member

    @thirstcard

    Hi guys

    I am using the following to get the total number of friends a logged in user has.

    friends_get_total_friend_count( $user_id = bp_loggedin_user_id()

    How could I get the total number of followers a logged in user has?

    Also, I’d like to be able to display the total number of people a logged in user is following.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Avatar of Hugo
    Hugo
    Moderator

    @hnla

    That should be in the plugin somewhere?

    It displays this in a profile account doesn’t it?

    Followers: [2] Following: [2]

    Avatar of Henry
    Henry
    Member

    @thirstcard

    @Hugo

    It does. I’m not currently using the default menu so don’t get the Followers [2] Following [2]. I have come up with this to get the following count

    http://pastie.org/4001516

    Now just working on the ‘followers’ count. Any pointers will be great! :}

    Avatar of Henry
    Henry
    Member

    @thirstcard

    OK here’s my attempt which works for me:
    http://pastie.org/4001587

    If there is an easier way (or a way which is better practice) then let me know :}

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    bp_follow_total_follow_counts() is the function I used

    I used it in a function fed to a do_action in the members-header to produce that stat view above, you’re probably better off running this stuff in functions.php then you can feed it here there and everywhere you may need it.

    As for best practise, there are various means of grabbing data, there seem to be plenty of template functions one could use so that approach is possibly not the best, but if it works…

    Avatar of Henry
    Henry
    Member

    @thirstcard

    Thanks @Hugo

    functions.php is a good idea… i’ll do that so it can be reused throughout the theme.

    Avatar of mehulkaklotar
    mehulkaklotar
    Participant

    @mehulkaklotar

    Great. Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.