Buddypress Sidebar
Posted on Sunday, August 1st - 2010
Buddypress sidebar allows you to add extra sidebars to your buddypress site. By default Buddypress only has one sidebar which is limiting. This plugin allows you to create new sidebars at will.
Just name your new sidebar the same name as the Buddypress Component and it will show up when that component is displayed. So you can have separate sidebars for 'Activity', 'Members', 'Groups', etc. You can also name a sidebar the same name as any page and that sidebar will automatically show up on that page. Prefabricated sidebars include Home and Blog. The Blog sidebar will appear on single and archive blog pages.
Plugin Groups
Contribute to plugin development or simply participate by joining the group.
Instructions:
- Install the plugin
- From the WordPress dashboard navigate to the plugin settings via the Buddypress sidebar link/icon. Then click on BP Sidebar.
- Use the default sidebars or enter a comma separated list of your own.
- Chose the option 'Display below the default Buddypress Sidebar widget' to show your sidebars under instead of above the default 'Buddypress Sidebar Widget'.
- You can create a page in WordPress and then create a new 'BP Sidebar' with the same name. This will enable you to have a unique sidebar on that one page.
Here is the admin page:

35 Responses to “Buddypress Sidebar”
Leave a Reply



How to activate the sidbar for an individual members profile page?
we have /members/ but not /members/bp-membername/
curious if the plugin will allow for wildcards or not, and if so, which one to use.
thanks
I am working on a way to include buddypress activity sidebars, a couple weeks maybe.
The members profile page is actually under the 'activity' component and the 'just-me' action, not under the members component like you might think. If you dont want to wait until my plugin update, add the code below to your 'functions.php' file.
function show_custom_sidebar(){
global $bp;
$chosen_action = 'just-me';
$the_sidebar_name = $bp->current_action;
if($the_sidebar_name == $chosen_action) bps_show_sidebar($chosen_action);
}
if(get_option('bps_sidebar_position') == 'after'){
add_action('bp_inside_after_sidebar','show_custom_sidebar');
}
else {
add_action('bp_after_sidebar_me','show_custom_sidebar');
add_action('bp_after_sidebar_login_form','show_custom_sidebar');
}
The code above makes it so that when I place a widget into the 'activity' stream it shows up on the activity page as well as the members individual page.
I was kind of expecting the code to create a dedicated sidebar called 'just-me' but alas, there is not one added to my sidebar list.
I'm using bp-default, and so far have not created a childtheme. I simply added the above code to the bp-default functions.php file.
What I am after is a sidebar that works 'only' for the members/membersname/ page if it's possible at this point.
Sorry I did not explain in more detail. You can create a sidebar for the 'just-me' page, simply register a new sidebar from the Buddypress Sidebar admin page and call it 'just-me'. The snippet just shows that sidebar on the member profile page. You need to match the sidebar names with the actual name of the component or activity.
Speaking of that I just released a plugin that displays that info in a neat tool for this type of thing. http://hyperspatial.com/wordpress-development/plugins/buddypress-pagetrace/
LOL, sometimes I can be such an idiot ... thnx for the explanation.
I have not been able to get it to work. Is there another step that I'm missing or something- installed the plugin on two sites, one a new wp install. I put some widgets in the sidebars on the widgets page, but the front end remains sidebar-less.
Great idea if it works!
I'm working on http://www.desbar.com and I want to use your plugin but meanwhile - to preserve the existing sidebar. On some of the pages I want 2 sidebars and on the other - I want 1 sidebar only.. :)
Is there an easy workaround using this plugin ?
I've installed it and it works as described. It's great, but it will be great if you add more functions. Also it will be great if you add positions somehow - left / right aligned sidebars.
just an idea...
Best,
M.
Just a silly question, do you have the Buddypress plugin installed?
Ralev, use the default "sidebar" provided by buddypress. There is an option in my plugin to display the additional sidebars below or above the default buddypress sidebar. That is the best I can do for positioning.
As far as left and right sidebars go, that is theme specific, try installing a theme that offers that, there are not a lot of buddypress compatible themes right now but that will change.
To show only certain sidebars use css to hide the ones you don't want on certain pages, buddypress had a "Body Class" that allows you to target individual pages for styling, then just do a display:none; with css to hide the sidebar div you dont want.
Cannot get it to work at all ... the other plugin (Pagetrace) either. In other words, the BP sidebars simply do not show.
I am not using a standard buddypress ready template, but a standard one which was "adapted" to buddypress using BuddyPress Theme Compatibility.
Could you please tell which code should I add to my template and where, in order to get your plugins to work?
Thank you!
I have never tested the plugins under those conditions. I would definitely recommend creating a buddypress child theme instead of using the compatibility template, I had troubles with it from the get go. The child theme thing rules. You basically create a theme folder and a css style sheet linked to buddypress' default theme. Check BP for instructions. Then whatever file you put in that folder overwrites the default theme file of the same name. This way you never need to worry about editing the core.
Hi,
how can I put a sidebar not under the default Buddypress' sidebar but put a sidebar on the left side? I would like have 2 sidebar, one on the right side and one on the left sidebar.
Tanks
Having a left sidebar is theme related. Check around for a Buddypress theme with a left sidebar, otherwise you would need to edit the theme yourself, its a complicated process and unless you are a css guru I would not attempt it. The plugin itself has no way to accomplish this.
Im having a problem with BPSB.
I installed it and it seemed to be working.
But then suddenly the Home sidebar disappeared although it wa still there in Admin sections.
I tried remaking the menus
then I deactivated and reactivated the plugin
then I deleted the plugin and reinstalled. None of this helped.
(once the plugin is deactivated the Home sidebar reappears though).
It seems to have remembered my setting through being uninstalled and reinstalled so Im wondering if there is a database table that I can drop that will take me back to scratch so I can begin again?
I did try making sidebars for other pages such as Events/New and had no success
but maybe this is where I stuffed something up in the database that caused the Home sidebar problem?
I also have at the bottom of my widget admin sidebars list underneath all the expected
ones such a Home, Blog, Activity, etc -
a blank bar and then one that says Sidebar.
Sidebar seems to be a default of some sort as when I add content there it appears in the Homepage sidebar.
The blank tab does not seem to appear anywhere when I add widgets to it.
Please explain what the blank and Sidebar widget areas are supposed to do?
Or am I only seeing them cause I stuffed sometghing up?
Hello Dan,
The sidebar named sidebar is the Buddypress default one, any content you put there will show up on all your buddypress pages. The plugin does not create any new database tables, it only registers new widgets and the WordPress system takes over from there, so if you want to tinker with any database stuff it would be in the tables WP uses for sidebar data. The blank sidebars are not default behavior, I have actually never witnessed that behavior in wordpress.
Diagnosing issues like this can difficult, I can try to help you out further and you can email me directly at adam@hyperspatial.com - Let me know what version of buddypress you are using and also what theme, I have not tested the plugin on any other themes except the buddypress default theme. I have a feeling that this may be theme related.
I have clarified for myself what exactly is going wrong.
The problem with the blank sidebar was as simple as having an extra comma after the last sidebar name in BPSB admin :-P
The only problem remaining now is that the Home and Blog sidebars do not show up.
All the other pages work.
You will notice on my site that on the Activity and Events and Members pages
under the top meta widget there is a text widget created through BPSB.
However on the Home and Blog pages there is meant to be a similar text widget and it is not appearing.
Are Home and Blog handled differently? I notice that you mention them in the plugins admin instructions.
Thanks - Dan V
The home and blog sidebars are treated differently, the plugin checks the page using the wp functions is_home(); is_single(); and is_archive(); if any of these are true then that sidebar is the one to be loaded. The rest of the sidebars use the BP $bp->current_component property to load a sidebar with the same name.
Here are a couple theories:
If you are using a static page for the home page that might be an issue, if you can edit the php of the plugin try replacing the code on line 191 with this: if(is_home() || is_front_page()) $the_sidebar_name = 'Home';
Also make sure that your homepage, archive.php and single.php have a call to the sidebar, it should look like this: locate_template( array( 'sidebar.php' ), true );
If that is missing then there wont be any sidebar on those pages.
I need to do updates on a few of my plugins but I am so swamped at work. I need a clone
Hi Adam - thanks for your reply.
And thanks for the examples you provide in the latest upgrade.
I have managed to link to all sorts of BP pages
including some made by the Eventpress plugin
for instance 'Event Create' works.
BPSB really is an essential BP addon!
Im confused about your instructions for fixing my Home and Blog problem though - none of the plugin files seem to go as far as line 191.
Would you please say what text I am supposed to replace with this?
I have checked Archive.php and Single.php and Page.php all call the sidebar.
When I go to the Homepage or the Blog I see Null&Null in the Component and Action indicator. Yes my homepage is a static one.
I just wish I could solve this small problem so that I can use all the other features :-(
BTW one more small bug that is rather annoying but not serious...
when I add new menus and then go to the Widgets page
all the previous sidebars I have made have slipped up the list vertically to the next new and therefore vacant sidebar.
Ummm let me try to explain that again...
If the new sidebar is number three from the top of the list
then the content from sidebar 4 that was there previously has moved up to number 3.
Likewise position 5s widgets have slipped up to 4.
I can drag all the widgets back down the list to where they belong
but it is a bit messy.
To anyone else reading this though - so long as you dont have a problem with the Home and Blog pages I reckon this is a very useful and easy to manage plugin!
I updated the plugin to include a conditional that treats a static front page as home, so I am hoping that it should work for you now.
The way wordpress registers sidebar widgets is by an ID number, so if you have 5 sidebar widgets they are numbered 1-5. The contents of the widgets are associated with the ID number. The plugin is basically renaming those 5 sidebars or adding more.
If you think about it that way, the shift you are describing should make more sense. All the plugin does is assign names to the sidebars. For example if you have sidebars set like this: (home,blog,members) and decide to slip one in at the beginning like: (site map,home,blog,members) then the content that was in home(widget #1) will then be in the new "site map" widget. Just remember you are renaming sidebars not actually shifting them around.
If you have 5 sidebars and then change over to 4, then the content in widget #5 will be moved to the inactive widget section in WP because there is no #5 to hold the widget content anymore.
I haven't been able to get this to work with my custom pages. It works fine for standard Buddypress pages. The Show Component & Action Indicator shows NULL for both component and action. I tried just using the name of the page in my sidebar list and that didn't work either. Any ideas?
Great plugin though...
Thanks for any help in advance.
I noticed a syntax error on the fallback to the page name when there is no component name. I don't know if the update will fix your issue but hopefully so.
The component name always matches the page name on all my Buddypress installs, so I don't know what is missing in the data flow to the component name variable.
Good luck, let me know if you get it working.
Hi Adam -
Thanks for the update - it half works (or actually double works).
Now both the Home and Blog sidebars appear on both the Home and Blog page. LOL.
Better than before though - I can work with it.
Thanks very much for this essential plugin - it really makes a huge difference for me to be able to add video instructions in the text/html widget on each page !
Maybe next upgrade will separate Home from Blog?
Dan V
I have installed this plugin with the standard default buddypress simple community theme that comes with buddypress. How do I target the left sidebar?? ie if I place some text in the HOME labeled sidebar, it appears in the right sidebar not left? Cant get anything into left sidebar. Also home displays Null and Null in the test fields, should it not display Home as component instead of Null?
There is not left sidebar in the buddypress default theme. You can arrange one using css, or by editing the theme template files.
Budypress does show the home page as null-null and that is default behavior, the plugin uses a couple wp functions to target the home page, is_home() and is_front_page(), so if you name a sidebar home it should display on the front page.
Thank you so much for this plugin, it's brilliant.
Thanks aljuk, appreciate it!
Thanks for the plugin Adam. We're using it for our SEO community, but I wanted to know if there was a way to customize the sidebar contents for each group individually. For example, I would love to display just Magento-related SEO information for the Magento SEO group as opposed to global information.
Thanks!
Chris
The plugin does not have that functionality but if you are not afraid of editing some php files you can put some conditionals in the sidebar.php file that will get the job done:
<?php if(bp_current_item() == 'mothers') echo "This is the special content for the Mother's Group" ?>
The bp_current_item() function checks for the group slug, in this case mothers and displays whatever content you want when you are on that particular group page.
Adam: Great plugin - thanks!
I was having similar issue as Dan V. above with a static page as the front page and my posts going to a "Blog" page, so I poked around the code.
Line 257:
if(is_front_page()) $the_sidebar_name = 'Home'; should be elseif, no?
I'm no programmer, but here's a modification that worked for me after registering sidebars "Home" and "Blog" in case it helps anybody else:
Line 255:
if(is_home() || is_single() || is_archive()) $the_sidebar_name = 'Blog';
elseif(is_front_page()) $the_sidebar_name = 'Home';
I first tried bps_show_blog_sidebar(); in the first line instead of $the_sidebar_name = 'Blog' but it didn't work so I guess that function isn't picking up the page posts are assigned to.
It would be great if the plugin picked up changes to the assigned front page and posts page so the code doesn't need to be modified, as I assume an update to the plugin will undo this modification.
[...] Friends: untuk menampilkan teman dari memberBuddyPress Chat Component: untuk chatting antar memberBuddypress Sidebar: untuk menambah sidebar pada halamanCD BuddyPress Avatar Bubble: untuk menampilkan identitas member [...]
If I use buddybar with this widget the only way I can get it to work is by unchecking the options for Display sidebars below the default BP sidebar widget and Show Component & Action Indicator. If i have the option Display sidebars below the default BP sidebar widget checked it repeats buddybar to infinity, one after the other. I wish there were an easier way. Also, looking for a better solution than buddybar. Even with this incompatibility, I’m glad I can at least get some custom sidebars going!
I have not tested or used the buddybar plugin but might take a look at some point. If you really need to get this working feel free to contact me. I am super busy but might be able assist.
Great plugin! Don't know what I would do without it. I'm having a similar issue with the homepage and main page of the blog sidebars though. Both pages are displaying the homepage widgets (sidebar) and then specific blog posts, categories, etc. are displaying the correct blog widgets (sidebar). Any help on this?
Thanks, I will try to take a look at the front page issue this weekend, please clarify the part about "both pages are displa....."
I think its just the wording that's confusing me. Feel free to just email me at adam@hyperspatial.com if you want.
Comment 17 above (at http://hyperspatial.com/2010/08/buddypress-sidebar/comment-page-1/#comment-262 ) works for me. I have updated this code in my plugin and made a backup of the whole plugin should an update happen to mis-include these fixes. Awesome plugin especially when combined with Widget Logic. Thanks.