Displaying 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:
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. :)






That’s funny I’ve just finished the same thing for my upcoming theme… great minds think alike :)
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?
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…
This is nice! what about a Mutual Friends Widget????
Hello,
I meet this error:
Fatal error: Call to undefined function bp_has_members() in ***/wp-content/plugins/buddypress-my-friends-widgets/buddypress-my-friends-widgets.php on line 88
@01on Are you using 1.2 RC ? It’s not made for older versions of BuddyPress.
@Sarah Gooding
I’m using BuddyPress 1.1.3
Sorry,I didn’t known that this plugin require BuddyPress 1.2.
Where can I down BuddyPress 1.2 ?
There is only 1.1.3 here: http://buddypress.org/download/
Here ya go. http://buddypress.org/blog/news/buddypress-1-2-rc2/ There are instructions there for how to upgrade. You will really like 1.2 much better because there are tons of new features. :)
@Sarah Gooding
Thank you.
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.
Nice! Thanks for sharing that. :)
np. that was for the earlier comment asking how to. :) thank you for sharing your jumpstart that got us to that little discovery!
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?
This widget works well when logged in, that is, it shows friends as intended. However, when logged out it creates a sign-up link which, in my case, point to the wrong link. My BuddyPress website is not located at the root, but the widget points to the root for registration. Example:
Sign-up should be like this: http://www.website.com/main/register
But the widget points to this: http://www.website.com/register
Is there a quick work around for this?
Joh- Yes, just edit the plugin’s PHP file and where you see: Login or < a href=”/register/” change to have “/main/register/” instead. :)
@Sarah
Awesome! You da best!