Skip to:
Content
Pages
Categories
Search
Top
Bottom

how to show friends

  • Profile photo of Famous
    Famous
    Participant

    @famous

    what php code snippet can I use to show friends?

    Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    This is a widget
    https://wordpress.org/extend/plugins/bp-show-friends/

    I haven’t used this and don’t know if it’s compatible with BP 1.5 as is.

    If you don’t want a widget and don’t know how to write your own query, you could do something like this – untested by me:

    <?php
    $user_id = $bp->loggedin_user->id;
    $args = 'user_id='.$user_id.'&per_page=10&populate_extras=0';
    if ( bp_has_members( $args ) ){
    ?>
    
    <div class="item-avatar">
    <a href=&quot;"></a>
    </div>
    
    <?php
    }
    else echo 'You have no friends!';
    ?>

    I believe, that if you pass user_id to bp_has_members loop, it only returns the friends of that user_id.

    Profile photo of Famous
    Famous
    Participant

    @famous

    @shaneBP
    Thanks shane, it worked. Is there a way to use the larger user avatar rather than the smaller one? Thanks

    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

    Probably :
    bp_member_avatar(‘type=full’)

    Profile photo of funmi omoba
    funmi omoba
    Participant

    @funmi-omoba

    @shaneBP, is there a way the code can also display names in front of the Avatar. i mean something like facebook?

    thank you

    Profile photo of shanebp
    shanebp
    Moderator

    @shanebp

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘how to show friends’ is closed to new replies.
Skip to toolbar