New Plugin Available: BuddyPress My Friends Widgets – Download Here

screenshot-1Displaying a user’s friends in the sidebar is something that simply makes sense for a lot of community sites. Although there are widgets available for showing members, recently active members, and who’s online, BuddyPress does not come packaged with a widget for displaying a logged in user’s friends in the sidebar. If users are easily able to see their friends when they log in, they are more likely to check up on each other and start interacting. I wrote this little plugin last night for WordPress 2.9.1 and BuddyPress 1.2. Last week Damon Cook made a BuddyPress widgets pack using a couple of our tutorials here at WPMU.org, so I took some inspiration from his idea and made some more widgets that I think you will find to be very useful. This is my first plugin, so if you see anything wrong with how it’s written, please leave a note in the comments. I submitted it to the WordPress repository so hopefully it will show up there soon, but you can download it right here for now.

BuddyPress My Friends Widget comes with two widgets for displaying a logged in user’s friends. The small size displays 40px avatars and the big size displays 82px avatars, as you can see in the screenshots. If the user is not logged in, they will see a message that says “Login or Register to make some friends!” In the near future I will add the ability for users to select how many avatars to display in the widget options, but for now it’s set at 20 for the small ones and 10 for the big size. They are your basic drag and drop widgets – it’s so easy, even a girl can do it! ;)

Simple Installation:

screenshot-2

Step 1: Download the BuddyPress My Friends Widgets Plugin.

Step 2: Upload to the Plugins Directory.

Step 3: Activate the Plugin.

Step 4: Navigate to Dashboard >> Appearance >> Widgets and drag and drop them where you want them.

I always wondered why there wasn’t a widget to easily show your own friends in the sidebar. Now there is! If you give this plugin a try, please let us know how it works for you and what improvements you’d like to see for the next version. :)

Tags

Comments (29)

  1. Hi , your articles are really helpful !! thanks, well I have one query I would like to show some friends suggestion based on activities i.e if one person make an activity as his “Favorite” and some other person somewhere make the same activity as his “Favorite”. so how to suggest people like this for friend suggestion?

  2. wow, really love that plugin! using it right now.
    how about a widget for displaying friends of a user? with 1.2 there is no nice way of displaying some ele’s friend directly on the profile, you have to click the friends tab first…

  3. bp_has_members( ‘type=newest&max=20&user_id=’ . bp_loggedin_user_id() ) & is_user_logged_in() ) :

    found that that replacing that line with

    ?php if ( bp_has_members( ‘per_page=40&type=active&user_id=&max=30′ . $bp->displayed_user->id == $bp->loggedin_user->id) ) : ?

    works to show the current user’s friends not only your own.

  4. Thanks for the plugin. Currently it shows a ‘log in or sign up message’ even if users are logged in but don’t have any friends. Maybe a different message (make some friends with a link to the members list) for that in the next update?

  5. Hi there , I use it and works , but when a user logged in – but have no friends – plugin shows a message : Login or Sign Up …
    hmm i think it’s better to show : “You have no friend” or something like this.

  6. For other readers: To completely hide the widget when the user is not signed in, add the following statement just before the two extract() calls:

    if ( !is_user_logged_in() ) return;

    Sarah: Would like to see settings available in Appearance > Widgets > My Friends:
    * dropdown or radio buttons: Avatar size: large, small (rather than two widgets); may be “medium” that is 3 avatars per row. Or may be “Avatars per row: 2, 3, 4″.
    * text field: Max Friends to show (round to nearest row size, and limit to 100).
    * checkbox: Show only when signed in
    * checkbox: Link to Members when no friends. (e.g.: “No Friends”, “No Friends. Make Friends (with link to Members slug)”).

  7. I like this plugin alot. since it limits the amount of friends displayed, I just needed it to also have a link to say “View All”.

    I added it by doing this:
    Find:
    extract( $args );

    and paste the following AFTER it:

    // get username
    global $current_user;
    $username = $current_user->user_login;

    then replace
    . 'My Friends'
    with the following:
    . 'My Friends      View All'

    — repeat that for the small and large avatar sections.

  8. oops, the last line actually displayed the html.. let me try to repost that correctly… ……………..

    I like this plugin alot. since it limits the amount of friends displayed, I just needed it to also have a link to say “View All”.

    I added it by doing this:
    Find:
    extract( $args );

    and paste the following AFTER it:

    // get username
    global $current_user;
    $username = $current_user->user_login;

    then replace
    . 'My Friends'
    with the following:
    . 'My Friends      <a href="/members/' . $username . '/friends/">View All</a>'

    — repeat that for the small and large avatar sections.

Participate