Skip to:
Content
Pages
Categories
Search
Top
Bottom

Show number of friends within members loop bp_the_site_member_total_friend_count

  • @thomasbp

    Participant

    I’m trying to display the number of friends a user has within the members loop.

    I found this function “bp_the_site_member_total_friend_count()” which appears to be the appropriate way (at least it’s listed next to other members loop functions http://bp-dev.org/phpxref/nav.html?_functions/index.html ). However, it doesn’t output anything.

    Do I have to pass an argument while calling that function (ID of the user didn’t work) or what am I doing wrong?

Viewing 4 replies - 1 through 4 (of 4 total)
  • @buzz2050

    Participant

    No, this function does not take any parameters from what I know. It is supposed to work as is. But it doesn’t in my case either. Not sure why.

    This is the workaround that I am using in my members-loop which does seem to work:

    ‘global $site_members_template ;

    $frndCnt = friends_get_friend_count_for_user($site_members_template->member->id) ;

    echo $frndCnt ;’

    -Sib

    @djpaul

    Keymaster

    As long as you are doing this from within the bp_has_site_members() loop (and not the friends loop or something by accident), it should work. Have a look at the usage in theme/directories/members/index.php

    @thomasbp

    Participant

    I’m late, but thx u2!

    @DPaul: I’ve used that template while I was desparately looking for a solution. However, I probebly miss something obvious.

    @buzz2050: Your workaround did it!

    @blauweogen

    Participant

    It works for me BUT
    I am trying to get the total users for each user not the one logged in. I want to show popular members (which I have) with the total friends each has. Don’t know code well enough, anyone know how? I assume it is a little like Buzz2050 workaround.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Show number of friends within members loop bp_the_site_member_total_friend_count’ is closed to new replies.
Skip to toolbar