Helping you Build Your Own Social Network!

Faster, better and easier!

Remove Buddypress admin bar from all blog except the main buddypress site

Jotted by Brajesh Singh in Buddypress, Buddypress Free Plugins, Buddypress Tricks, Plugins on November 5, 2009
We are Hiring new WordPress/buddyPress developers

Do you want to remove buddypress admin bar from all blog except the blog on which buddypress is activated.

here is a small snippet of code that you can use to remove the buddypress admin bar.Put it into bp-custom.php


function remove_bpadminbar(){
global $current_site;
if($current_site->blog_id!=BP_ROOT_BLOG) //if current blog is not the one on which buddypress is activated
{
remove_action( 'wp_footer', 'bp_core_admin_bar', 8 );//remove buddypress admin bar
}

}
add_action("wp","remove_bpadminbar");

?>

You can put it into a file and drop in to mu-plugins directory or use put it inside bp-custom.php.

Happy social networking with Buddypress :) and yeh,let me know in comments how it worked for you.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • BlinkList
  • DZone
  • FriendFeed
  • IndianPad
  • MySpace
  • Netvouz
  • Reddit
  • SphereIt
  • StumbleUpon
  • Technorati

Related posts:

  1. Remove /blog slug from the default blog of wpmu subdirectory installation
  2. Disable Blog Posts and new Blog Comments recording/tracking In the activity by BuddyPress
  3. Stealth Mode for Buddypress Site Admin Plugin
  4. Playing With buddypress and WordPress, some codes for the site admins
  5. Allow Users to select a blog theme while signing up/creating a blog on your buddypress powered social network

8 Responses to Remove Buddypress admin bar from all blog except the main buddypress site

  • Hi Brajesh,
    I’ve been trying to adjust this code to my needs but with no luck :(

    I’d have a single blog on a WP3.0 network site that I’d like the BP adminbar not to display on. The Blog ID = 3.

    Can you please point me to a possible solution? Thanks in advance for your help.

    Cheers
    Paul

    • Hi Paul,
      Thanks for the comment. Please change the line

      if($current_site->blog_id!=BP_ROOT_BLOG)

      to

      if($current_site->blog_id==3)

      and It should work for you. Please do let me know if it works or not.

      Thanks
      Brajesh

      • Thanks Brajesh,
        unfortunately that didnt work.
        here’s the code I used for your reference…

        blog_id==3) //if current blog is not the one on which buddypress is activated
        {
        remove_action( ‘wp_footer’, ‘bp_core_admin_bar’, 8 );//remove buddypress admin bar
        }

        }
        add_action(“wp”,”remove_bpadminbar”);

        ?>

        • Sorry, that code didnt paste in correctly…..

          blog_id==3) //if current blog is not the one on which buddypress is activated
          {
          remove_action( ‘wp_footer’, ‘bp_core_admin_bar’, 8 );//remove buddypress admin bar
          }

          }
          add_action(“wp”,”remove_bpadminbar”);

          ?>

  • @Paul
    have you put the code in wp-content/plugins/bp-custom.php ?

  • @Paul I dunno if you still check up on this but I think the reason yours doesn’t work is that “<?php" is missing from the beginning of the code snippet. Posting this for Googlers that got here like I did.

    it should be:

    blog_id!=BP_ROOT_BLOG) //if current blog is not the one on which buddypress is activated
    {
    remove_action( ‘wp_footer’, ‘bp_core_admin_bar’, 8 );//remove buddypress admin bar
    }

    }
    add_action(“wp”,”remove_bpadminbar”);

    ?>

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Get Adobe Flash playerPlugin by wpburn.com wordpress themes