skip to Main Content
Menu

Tweaking Buddy Press Admin Bar

I wanted to do some customization on our Buddypress installation since the site is design to be open to the public. We wanted to be able to control the admin bar (Buddypress 1.5 and WordPress 3.2.1)

We found lots of functions and hooks and actions all over the net but the following combination of all of these was what we needed to

1) Disable the “Dashboard”
2) Create a new “Dashboard” without the link to the wordpress menu and rename it to “Post Articles
3) Install  “Post Articles” on the Buddypress/Wordpress admin bar that is visible

This little function was supposed to be placed inside the functions.php of our template, but instead, we tried placing it inside a bp-custom.php and placed this file (since we didn’t initially have this file.) into plugins/ folder.

function custom_adminbar_dashboard_button() {
// REMOVE ADMIN BAR ELEMENTS - the "Dashboard"
remove_action( 'bp_adminbar_menus', 'bp_adminbar_thisblog_menu', 6 );
// adds a "
Post Articles" link to the BuddyPress admin bar
if (is_user_logged_in())
{

// create "Post Articles" and sub items.
echo '

<ul class="main-nav">
<li id="bp-adminbar-account-menu"><a href="#">Post Articles</a>
<ul>
<li><a href="./wp-admin/post-new.php">New Post</a></li>
<li><a href="./wp-admin/edit.php">Manage Post</a></li>
</ul>
</li>

</ul>
';
}
}
//add the new item on the admin bar
add_action('bp_adminbar_menus', 'custom_adminbar_dashboard_button', 1);

Have fun tweaking..

Alphonse

Editorial Staff at ETN Multimedia is led by Alphonse Tan. Page maintained by Alphonse Tan

Back To Top