<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][4151] trunk: This first pass at WP Admin Bar integration unhooks all WP core menus and replaces them with a full set of action based routines to handle the creation of admin bar menus at a BP component class level.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd>4151</dd>
<dt>Author</dt> <dd>johnjamesjacoby</dd>
<dt>Date</dt> <dd>2011-03-24 05:26:18 +0000 (Thu, 24 Mar 2011)</dd>
</dl>
<h3>Log Message</h3>
<pre>This first pass at WP Admin Bar integration unhooks all WP core menus and replaces them with a full set of action based routines to handle the creation of admin bar menus at a BP component class level. This allows future external components to manipulate core menus or add their own with relative ease. Currently works off the BP_USE_WP_ADMIN_BAR constant, and should eventually phase out the BuddyBar in the long-term.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpactivitybpactivityloaderphp">trunk/bp-activity/bp-activity-loader.php</a></li>
<li><a href="#trunkbpblogsbpblogsloaderphp">trunk/bp-blogs/bp-blogs-loader.php</a></li>
<li><a href="#trunkbpcorebpcoreadminbarphp">trunk/bp-core/bp-core-adminbar.php</a></li>
<li><a href="#trunkbpcorebpcorecomponentphp">trunk/bp-core/bp-core-component.php</a></li>
<li><a href="#trunkbpcorebpcorehooksphp">trunk/bp-core/bp-core-hooks.php</a></li>
<li><a href="#trunkbpcorebpcoreloaderphp">trunk/bp-core/bp-core-loader.php</a></li>
<li><a href="#trunkbpforumsbpforumsloaderphp">trunk/bp-forums/bp-forums-loader.php</a></li>
<li><a href="#trunkbpfriendsbpfriendsloaderphp">trunk/bp-friends/bp-friends-loader.php</a></li>
<li><a href="#trunkbpgroupsbpgroupsloaderphp">trunk/bp-groups/bp-groups-loader.php</a></li>
<li><a href="#trunkbpmembersbpmembersloaderphp">trunk/bp-members/bp-members-loader.php</a></li>
<li><a href="#trunkbpmessagesbpmessagesloaderphp">trunk/bp-messages/bp-messages-loader.php</a></li>
<li><a href="#trunkbpsettingsbpsettingsloaderphp">trunk/bp-settings/bp-settings-loader.php</a></li>
<li><a href="#trunkbpxprofilebpxprofileloaderphp">trunk/bp-xprofile/bp-xprofile-loader.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpactivitybpactivityloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-loader.php (4150 => 4151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-loader.php        2011-03-23 21:30:29 UTC (rev 4150)
+++ trunk/bp-activity/bp-activity-loader.php        2011-03-24 05:26:18 UTC (rev 4151)
</span><span class="lines">@@ -100,15 +100,12 @@
</span><span class="cx">                         return;
</span><span class="cx">
</span><span class="cx">                 // Determine user to use
</span><del>-                if ( isset( $bp->displayed_user->domain ) ) {
</del><ins>+                if ( isset( $bp->displayed_user->domain ) )
</ins><span class="cx">                         $user_domain = $bp->displayed_user->domain;
</span><del>-                        $user_login = $bp->displayed_user->userdata->user_login;
-                } elseif ( isset( $bp->loggedin_user->domain ) ) {
</del><ins>+                elseif ( isset( $bp->loggedin_user->domain ) )
</ins><span class="cx">                         $user_domain = $bp->loggedin_user->domain;
</span><del>-                        $user_login = $bp->loggedin_user->userdata->user_login;
-                } else {
</del><ins>+                else
</ins><span class="cx">                         return;
</span><del>-                }
</del><span class="cx">
</span><span class="cx">                 // User link
</span><span class="cx">                 $activity_link = trailingslashit( $user_domain . $this->slug );
</span><span class="lines">@@ -123,6 +120,28 @@
</span><span class="cx">                         'position' => 10
</span><span class="cx">                 );
</span><span class="cx">
</span><ins>+                // @ mentions
+                $sub_nav[] = array(
+                        'name' => __( 'Mentions', 'buddypress' ),
+                        'slug' => 'mentions',
+                        'parent_url' => $activity_link,
+                        'parent_slug' => $this->slug,
+                        'screen_function' => 'bp_activity_screen_mentions',
+                        'position' => 20,
+                        'item_css_id' => 'activity-mentions'
+                );
+
+                // Favorite activity items
+                $sub_nav[] = array(
+                        'name' => __( 'Favorites', 'buddypress' ),
+                        'slug' => 'favorites',
+                        'parent_url' => $activity_link,
+                        'parent_slug' => $this->slug,
+                        'screen_function' => 'bp_activity_screen_favorites',
+                        'position' => 30,
+                        'item_css_id' => 'activity-favs'
+                );
+
</ins><span class="cx">                 // Additional menu if friends is active
</span><span class="cx">                 if ( bp_is_active( 'friends' ) ) {
</span><span class="cx">                         $sub_nav[] = array(
</span><span class="lines">@@ -131,7 +150,7 @@
</span><span class="cx">                                 'parent_url' => $activity_link,
</span><span class="cx">                                 'parent_slug' => $this->slug,
</span><span class="cx">                                 'screen_function' => 'bp_activity_screen_friends',
</span><del>-                                'position' => 20,
</del><ins>+                                'position' => 40,
</ins><span class="cx">                                 'item_css_id' => 'activity-friends'
</span><span class="cx">                         ) ;
</span><span class="cx">                 }
</span><span class="lines">@@ -144,34 +163,78 @@
</span><span class="cx">                                 'parent_url' => $activity_link,
</span><span class="cx">                                 'parent_slug' => $this->slug,
</span><span class="cx">                                 'screen_function' => 'bp_activity_screen_groups',
</span><del>-                                'position' => 30,
</del><ins>+                                'position' => 50,
</ins><span class="cx">                                 'item_css_id' => 'activity-groups'
</span><span class="cx">                         );
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                // Favorite activity items
-                $sub_nav[] = array(
-                        'name' => __( 'Favorites', 'buddypress' ),
-                        'slug' => 'favorites',
-                        'parent_url' => $activity_link,
-                        'parent_slug' => $this->slug,
-                        'screen_function' => 'bp_activity_screen_favorites',
-                        'position' => 40,
-                        'item_css_id' => 'activity-favs'
-                );
</del><ins>+                parent::_setup_nav( $main_nav, $sub_nav );
+        }
</ins><span class="cx">
</span><del>-                // @ mentions
-                $sub_nav[] = array(
-                        'name' => sprintf( __( '@%s Mentions', 'buddypress' ), $user_login ),
-                        'slug' => 'mentions',
-                        'parent_url' => $activity_link,
-                        'parent_slug' => $this->slug,
-                        'screen_function' => 'bp_activity_screen_mentions',
-                        'position' => 50,
-                        'item_css_id' => 'activity-mentions'
-                );
</del><ins>+        /**
+         * Set up the admin bar
+         *
+         * @global obj $bp
+         */
+        function _setup_admin_bar() {
+                global $bp;
</ins><span class="cx">
</span><del>-                parent::_setup_nav( $main_nav, $sub_nav );
</del><ins>+                // Menus for logged in user
+                if ( is_user_logged_in() ) {
+
+                        // Setup the logged in user variables
+                        $user_domain = $bp->loggedin_user->domain;
+                        $activity_link = trailingslashit( $user_domain . $this->slug );
+
+                        // Add the "Activity" sub menu
+                        $wp_admin_nav[] = array(
+                                'parent' => $bp->my_account_menu_id,
+                                'id' => 'my-account-' . $this->id,
+                                'title' => __( 'Activity', 'buddypress' ),
+                                'href' => trailingslashit( $activity_link )
+                        );
+
+                        // Mentions
+                        $wp_admin_nav[] = array(
+                                'parent' => 'my-account-' . $this->id,
+                                'title' => __( 'Mentions', 'buddypress' ),
+                                'href' => trailingslashit( $activity_link . 'mentions' )
+                        );
+
+                        // Personal
+                        $wp_admin_nav[] = array(
+                                'parent' => 'my-account-' . $this->id,
+                                'title' => __( 'Personal', 'buddypress' ),
+                                'href' => trailingslashit( $activity_link )
+                        );
+
+                        // Favorites
+                        $wp_admin_nav[] = array(
+                                'parent' => 'my-account-' . $this->id,
+                                'title' => __( 'Favorites', 'buddypress' ),
+                                'href' => trailingslashit( $activity_link . 'favorites' )
+                        );
+
+                        // Friends?
+                        if ( bp_is_active( 'friends' ) ) {
+                                $wp_admin_nav[] = array(
+                                        'parent' => 'my-account-' . $this->id,
+                                        'title' => __( 'Friends', 'buddypress' ),
+                                        'href' => trailingslashit( $activity_link . bp_get_friends_slug() )
+                                );
+                        }
+
+                        // Groups?
+                        if ( bp_is_active( 'groups' ) ) {
+                                $wp_admin_nav[] = array(
+                                        'parent' => 'my-account-' . $this->id,
+                                        'title' => __( 'Groups', 'buddypress' ),
+                                        'href' => trailingslashit( $activity_link . bp_get_groups_slug() )
+                                );
+                        }
+                }
+
+                parent::_setup_admin_bar( $wp_admin_nav );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         /**
</span></span></pre></div>
<a id="trunkbpblogsbpblogsloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs/bp-blogs-loader.php (4150 => 4151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs/bp-blogs-loader.php        2011-03-23 21:30:29 UTC (rev 4150)
+++ trunk/bp-blogs/bp-blogs-loader.php        2011-03-24 05:26:18 UTC (rev 4151)
</span><span class="lines">@@ -112,8 +112,41 @@
</span><span class="cx">                 // Setup navigation
</span><span class="cx">                 parent::_setup_nav( $main_nav );
</span><span class="cx">         }
</span><del>-        
</del><ins>+
</ins><span class="cx">         /**
</span><ins>+         * Set up the admin bar
+         *
+         * @global obj $bp
+         */
+        function _setup_admin_bar() {
+                global $bp;
+
+                // Menus for logged in user
+                if ( is_user_logged_in() ) {
+
+                        $blogs_link = trailingslashit( $bp->loggedin_user->domain . $this->slug );
+
+                        // Add the "Blogs" sub menu
+                        $wp_admin_nav[] = array(
+                                'parent' => $bp->my_account_menu_id,
+                                'id' => 'my-account-' . $this->id,
+                                'title' => __( 'Blogs', 'buddypress' ),
+                                'href' => trailingslashit( $blogs_link )
+                        );
+
+                        // My Blogs
+                        $wp_admin_nav[] = array(
+                                'parent' => 'my-account-' . $this->id,
+                                'title' => __( 'My Blogs', 'buddypress' ),
+                                'href' => trailingslashit( $blogs_link . 'my-blogs' )
+                        );
+
+                }
+
+                parent::_setup_admin_bar( $wp_admin_nav );
+        }
+
+        /**
</ins><span class="cx">          * Sets up the title for pages and <title>
</span><span class="cx">          *
</span><span class="cx">          * @global obj $bp
</span></span></pre></div>
<a id="trunkbpcorebpcoreadminbarphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-adminbar.php (4150 => 4151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-adminbar.php        2011-03-23 21:30:29 UTC (rev 4150)
+++ trunk/bp-core/bp-core-adminbar.php        2011-03-24 05:26:18 UTC (rev 4151)
</span><span class="lines">@@ -1,7 +1,41 @@
</span><span class="cx"> <?php
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Reserved for WordPress admin bar functions
</del><ins>+ * BuddyPress Core Admin Bar
+ *
+ * Handles the core functions related to the WordPress Admin Bar
+ *
+ * @package BuddyPress
+ * @subpackage Core
</ins><span class="cx"> */
</span><span class="cx">
</span><ins>+/**
+ * Unhook the WordPress core menus. We will be adding our own to replace these.
+ *
+ * @todo Single blog/post/group/user/forum/activity menus
+ * @todo Admin/moderator menus
+ *
+ * @since BuddyPress (r4151)
+ *
+ * @uses remove_action
+ * @uses is_network_admin()
+ * @uses is_user_admin()
+ */
+function bp_admin_bar_remove_wp_menus() {
+        remove_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 10 );
+        remove_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu', 20 );
+        remove_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 30 );
+        remove_action( 'admin_bar_menu', 'wp_admin_bar_shortlink_menu', 80 );
+
+        if ( !is_network_admin() && !is_user_admin() ) {
+                remove_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu', 40 );
+                remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 50 );
+                remove_action( 'admin_bar_menu', 'wp_admin_bar_appearance_menu', 60 );
+        }
+
+        remove_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 70 );
+}
+if ( defined( 'BP_USE_WP_ADMIN_BAR' ) )
+        add_action( 'bp_init', 'bp_admin_bar_remove_wp_menus', 2 );
+
</ins><span class="cx"> ?>
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkbpcorebpcorecomponentphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-component.php (4150 => 4151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-component.php        2011-03-23 21:30:29 UTC (rev 4150)
+++ trunk/bp-core/bp-core-component.php        2011-03-24 05:26:18 UTC (rev 4151)
</span><span class="lines">@@ -53,6 +53,11 @@
</span><span class="cx">         var $notification_callback;
</span><span class="cx">
</span><span class="cx">         /**
</span><ins>+         * @var array WordPress admin bar links
+         */
+        var $admin_menu;
+
+        /**
</ins><span class="cx">          * Component loader
</span><span class="cx">          *
</span><span class="cx">          * @since BuddyPress {unknown}
</span><span class="lines">@@ -188,6 +193,9 @@
</span><span class="cx">                 add_action( 'bp_setup_nav', array ( $this, '_setup_nav' ), 10 );
</span><span class="cx">
</span><span class="cx">                 // Register post types
</span><ins>+                add_action( 'bp_setup_admin_bar', array ( $this, '_setup_admin_bar' ), 10 );
+
+                // Register post types
</ins><span class="cx">                 add_action( 'bp_setup_title', array ( $this, '_setup_title' ), 10 );
</span><span class="cx">
</span><span class="cx">                 // Register post types
</span><span class="lines">@@ -213,6 +221,7 @@
</span><span class="cx">          * @param arr $sub_nav Optional
</span><span class="cx">          */
</span><span class="cx">         function _setup_nav( $main_nav = '', $sub_nav = '' ) {
</span><ins>+
</ins><span class="cx">                 // No sub nav items without a main nav item
</span><span class="cx">                 if ( !empty( $main_nav ) ) {
</span><span class="cx">                         bp_core_new_nav_item( $main_nav );
</span><span class="lines">@@ -230,6 +239,36 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         /**
</span><ins>+         * Setup the admin bar
+         *
+         * @global obj $wp_admin_bar
+         * @param array $wp_admin_menus
+         */
+        function _setup_admin_bar( $wp_admin_nav = '' ) {
+
+                // Do not proceed if constant is not set
+                if ( !defined( 'BP_USE_WP_ADMIN_BAR' ) )
+                        return;
+
+                // Do we have admin bar menus to add?
+                if ( !empty( $wp_admin_nav ) ) {
+
+                        // Set this objects menus
+                        $this->admin_menu = $wp_admin_nav;
+
+                        // Define the WordPress global
+                        global $wp_admin_bar;
+
+                        // Add each admin menu
+                        foreach( $this->admin_menu as $admin_menu )
+                                $wp_admin_bar->add_menu( $admin_menu );
+                }
+
+                // Call action
+                do_action( 'bp_' . $this->id . '_setup_admin_bar' );
+        }
+
+        /**
</ins><span class="cx">          * Setup the component title
</span><span class="cx">          *
</span><span class="cx">          * @since Buddypress {unknown}
</span></span></pre></div>
<a id="trunkbpcorebpcorehooksphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-hooks.php (4150 => 4151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-hooks.php        2011-03-23 21:30:29 UTC (rev 4150)
+++ trunk/bp-core/bp-core-hooks.php        2011-03-24 05:26:18 UTC (rev 4151)
</span><span class="lines">@@ -22,10 +22,13 @@
</span><span class="cx"> add_action( 'bp_init', 'bp_setup_globals', 4 );
</span><span class="cx">
</span><span class="cx"> // Setup the navigation menu
</span><del>-add_action( 'bp_init', 'bp_setup_nav', 8 );
</del><ins>+add_action( 'bp_init', 'bp_setup_nav', 7 );
</ins><span class="cx">
</span><ins>+// Setup the navigation menu
+add_action( 'bp_init', 'bp_setup_admin_bar', 8 );
+
</ins><span class="cx"> // Setup the title
</span><del>-add_action( 'bp_init', 'bp_setup_title', 8 );
</del><ins>+add_action( 'bp_init', 'bp_setup_title', 9 );
</ins><span class="cx">
</span><span class="cx"> // Setup widgets
</span><span class="cx"> add_action( 'bp_loaded', 'bp_setup_widgets' );
</span><span class="lines">@@ -57,6 +60,13 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * Set navigation elements
+ */
+function bp_setup_admin_bar() {
+        do_action( 'bp_setup_admin_bar' );
+}
+
+/**
</ins><span class="cx"> * Set the page title
</span><span class="cx"> */
</span><span class="cx"> function bp_setup_title() {
</span></span></pre></div>
<a id="trunkbpcorebpcoreloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-loader.php (4150 => 4151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-loader.php        2011-03-23 21:30:29 UTC (rev 4150)
+++ trunk/bp-core/bp-core-loader.php        2011-03-24 05:26:18 UTC (rev 4151)
</span><span class="lines">@@ -115,6 +115,11 @@
</span><span class="cx">                 if ( empty( $bp->pages ) )
</span><span class="cx">                         $bp->pages = bp_core_get_page_names();
</span><span class="cx">
</span><ins>+                /** Admin Bar *********************************************************/
+
+                // Set the 'My Account' global to prevent debug notices
+                $bp->my_account_menu_id = false;
+
</ins><span class="cx">                 /** Component and Action **********************************************/
</span><span class="cx">
</span><span class="cx">                 // Used for overriding the 2nd level navigation menu so it can be used to
</span></span></pre></div>
<a id="trunkbpforumsbpforumsloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-forums/bp-forums-loader.php (4150 => 4151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-forums/bp-forums-loader.php        2011-03-23 21:30:29 UTC (rev 4150)
+++ trunk/bp-forums/bp-forums-loader.php        2011-03-24 05:26:18 UTC (rev 4151)
</span><span class="lines">@@ -130,7 +130,7 @@
</span><span class="cx">                         'parent_slug' => $this->slug,
</span><span class="cx">                         'screen_function' => 'bp_member_forums_screen_topics',
</span><span class="cx">                         'position' => 20,
</span><del>-                        'item_css_id' => 'forums-friends'
</del><ins>+                        'item_css_id' => 'topics'
</ins><span class="cx">                 );
</span><span class="cx">
</span><span class="cx">                 // Additional menu if friends is active
</span><span class="lines">@@ -141,7 +141,7 @@
</span><span class="cx">                         'parent_slug' => $this->slug,
</span><span class="cx">                         'screen_function' => 'bp_member_forums_screen_replies',
</span><span class="cx">                         'position' => 40,
</span><del>-                        'item_css_id' => 'forums-friends'
</del><ins>+                        'item_css_id' => 'replies'
</ins><span class="cx">                 );
</span><span class="cx">
</span><span class="cx">                 // Favorite forums items
</span><span class="lines">@@ -152,13 +152,62 @@
</span><span class="cx">                         'parent_slug' => $this->slug,
</span><span class="cx">                         'screen_function' => 'bp_member_forums_screen_favorites',
</span><span class="cx">                         'position' => 60,
</span><del>-                        'item_css_id' => 'forums-favs'
</del><ins>+                        'item_css_id' => 'favorites'
</ins><span class="cx">                 );
</span><span class="cx">
</span><span class="cx">                 parent::_setup_nav( $main_nav, $sub_nav );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         /**
</span><ins>+         * Set up the admin bar
+         *
+         * @global obj $bp
+         */
+        function _setup_admin_bar() {
+                global $bp;
+
+                // "My Account" menu
+                if ( is_user_logged_in() ) {
+
+                        // Setup the logged in user variables
+                        $user_domain = $bp->loggedin_user->domain;
+                        $user_login = $bp->loggedin_user->userdata->user_login;
+                        $forums_link = trailingslashit( $user_domain . $this->slug );
+
+                        // Add the "My Account" sub menus
+                        $wp_admin_nav[] = array(
+                                'parent' => $bp->my_account_menu_id,
+                                'id' => 'my-account-' . $this->id,
+                                'title' => __( 'Forums', 'buddypress' ),
+                                'href' => trailingslashit( $forums_link )
+                        );
+
+                        // Topics
+                        $wp_admin_nav[] = array(
+                                'parent' => 'my-account-' . $this->id,
+                                'title' => __( 'My Topics', 'buddypress' ),
+                                'href' => trailingslashit( $forums_link . 'topics' )
+                        );
+
+                        // Replies
+                        $wp_admin_nav[] = array(
+                                'parent' => 'my-account-' . $this->id,
+                                'title' => __( 'My Replies', 'buddypress' ),
+                                'href' => trailingslashit( $forums_link . 'replies' )
+                        );
+
+                        // Favorites
+                        $wp_admin_nav[] = array(
+                                'parent' => 'my-account-' . $this->id,
+                                'title' => __( 'My Favorites', 'buddypress' ),
+                                'href' => trailingslashit( $forums_link . 'favorites' )
+                        );
+                }
+
+                parent::_setup_admin_bar( $wp_admin_nav );
+        }
+
+        /**
</ins><span class="cx">          * Sets up the title for pages and <title>
</span><span class="cx">          *
</span><span class="cx">          * @global obj $bp
</span></span></pre></div>
<a id="trunkbpfriendsbpfriendsloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-friends/bp-friends-loader.php (4150 => 4151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-friends/bp-friends-loader.php        2011-03-23 21:30:29 UTC (rev 4150)
+++ trunk/bp-friends/bp-friends-loader.php        2011-03-24 05:26:18 UTC (rev 4151)
</span><span class="lines">@@ -126,6 +126,56 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         /**
</span><ins>+         * Set up the admin bar
+         *
+         * @global obj $bp
+         */
+        function _setup_admin_bar() {
+                global $bp;
+
+                // "My Account" menu
+                if ( is_user_logged_in() ) {
+
+                        // Setup the logged in user variables
+                        $user_domain = $bp->loggedin_user->domain;
+                        $friends_link = trailingslashit( $user_domain . $this->slug );
+
+                        // Pending friend requests
+                        if ( $count = count( friends_get_friendship_request_user_ids( $bp->loggedin_user->id ) ) ) {
+                                $title = sprintf( __( 'Friends <strong>(%s)</strong>', 'buddypress' ), $count );
+                                $pending = sprintf( __( 'Pending Requests <strong>(%s)</strong>', 'buddypress' ), $count );
+                        } else {
+                                $title = __( 'Friends', 'buddypress' );
+                                $pending = __( 'No Pending Requests', 'buddypress' );
+                        }
+
+                        // Add the "My Account" sub menus
+                        $wp_admin_nav[] = array(
+                                'parent' => $bp->my_account_menu_id,
+                                'id' => 'my-account-' . $this->id,
+                                'title' => $title,
+                                'href' => trailingslashit( $friends_link )
+                        );
+
+                        // My Groups
+                        $wp_admin_nav[] = array(
+                                'parent' => 'my-account-' . $this->id,
+                                'title' => __( 'My Friends', 'buddypress' ),
+                                'href' => trailingslashit( $friends_link )
+                        );
+
+                        // Requests
+                        $wp_admin_nav[] = array(
+                                'parent' => 'my-account-' . $this->id,
+                                'title' => $pending,
+                                'href' => trailingslashit( $friends_link . 'requests' )
+                        );
+                }
+
+                parent::_setup_admin_bar( $wp_admin_nav );
+        }
+
+        /**
</ins><span class="cx">          * Sets up the title for pages and <title>
</span><span class="cx">          *
</span><span class="cx">          * @global obj $bp
</span></span></pre></div>
<a id="trunkbpgroupsbpgroupsloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups/bp-groups-loader.php (4150 => 4151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups/bp-groups-loader.php        2011-03-23 21:30:29 UTC (rev 4150)
+++ trunk/bp-groups/bp-groups-loader.php        2011-03-24 05:26:18 UTC (rev 4151)
</span><span class="lines">@@ -337,6 +337,58 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         /**
</span><ins>+         * Set up the admin bar
+         *
+         * @global obj $bp
+         */
+        function _setup_admin_bar() {
+                global $bp;
+
+                // Menus for logged in user
+                if ( is_user_logged_in() ) {
+
+                        // Setup the logged in user variables
+                        $user_domain = $bp->loggedin_user->domain;
+                        $groups_link = trailingslashit( $user_domain . $this->slug );
+
+                        // Pending group invites
+                        $count = groups_get_invites_for_user( $bp->loggedin_user->id );
+
+                        if ( !empty( $count->total ) ) {
+                                $title = sprintf( __( 'Groups <strong>(%s)</strong>', 'buddypress' ), $count->total );
+                                $pending = sprintf( __( 'Pending Invites <strong>(%s)</strong>', 'buddypress' ), $count->total );
+                        } else {
+                                $title = __( 'Groups', 'buddypress' );
+                                $pending = __( 'No Pending Invites', 'buddypress' );
+                        }
+
+                        // Add the "My Account" sub menus
+                        $wp_admin_nav[] = array(
+                                'parent' => $bp->my_account_menu_id,
+                                'id' => 'my-account-' . $this->id,
+                                'title' => $title,
+                                'href' => trailingslashit( $groups_link )
+                        );
+
+                        // My Groups
+                        $wp_admin_nav[] = array(
+                                'parent' => 'my-account-' . $this->id,
+                                'title' => __( 'My Groups', 'buddypress' ),
+                                'href' => trailingslashit( $groups_link )
+                        );
+
+                        // Invitations
+                        $wp_admin_nav[] = array(
+                                'parent' => 'my-account-' . $this->id,
+                                'title' => $pending,
+                                'href' => trailingslashit( $groups_link . 'invites' )
+                        );
+                }
+
+                parent::_setup_admin_bar( $wp_admin_nav );
+        }
+
+        /**
</ins><span class="cx">          * Sets up the title for pages and <title>
</span><span class="cx">          *
</span><span class="cx">          * @global obj $bp
</span></span></pre></div>
<a id="trunkbpmembersbpmembersloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-members/bp-members-loader.php (4150 => 4151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-members/bp-members-loader.php        2011-03-23 21:30:29 UTC (rev 4150)
+++ trunk/bp-members/bp-members-loader.php        2011-03-24 05:26:18 UTC (rev 4151)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx">                         'screens',
</span><span class="cx">                         'template',
</span><span class="cx">                         'buddybar',
</span><ins>+                        'adminbar',
</ins><span class="cx">                         'functions',
</span><span class="cx">                         'notifications',
</span><span class="cx">                 );
</span></span></pre></div>
<a id="trunkbpmessagesbpmessagesloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-messages/bp-messages-loader.php (4150 => 4151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-messages/bp-messages-loader.php        2011-03-23 21:30:29 UTC (rev 4150)
+++ trunk/bp-messages/bp-messages-loader.php        2011-03-24 05:26:18 UTC (rev 4151)
</span><span class="lines">@@ -152,6 +152,83 @@
</span><span class="cx">                         );
</span><span class="cx">                 }
</span><span class="cx">
</span><ins>+                parent::_setup_nav( $main_nav, $sub_nav );
+        }
+
+        /**
+         * Set up the admin bar
+         *
+         * @global obj $bp
+         */
+        function _setup_admin_bar() {
+                global $bp;
+
+                // "My Account" menu
+                if ( is_user_logged_in() ) {
+
+                        // Setup the logged in user variables
+                        $user_domain = $bp->loggedin_user->domain;
+                        $messages_link = trailingslashit( $user_domain . $this->slug );
+
+                        // Unread message count
+                        if ( $count = messages_get_unread_count() ) {
+                                $title = sprintf( __( 'Messages <strong>(%s)</strong>', 'buddypress' ), $count );
+                                $inbox = sprintf( __( 'Inbox <strong>(%s)</strong>', 'buddypress' ), $count );
+                        } else {
+                                $title = __( 'Messages', 'buddypress' );
+                                $inbox = __( 'Inbox', 'buddypress' );
+                        }
+
+                        // Add main Messages menu
+                        $wp_admin_nav[] = array(
+                                'parent' => $bp->my_account_menu_id,
+                                'id' => 'my-account-' . $this->id,
+                                'title' => $title,
+                                'href' => trailingslashit( $messages_link )
+                        );
+
+                        // Inbox
+                        $wp_admin_nav[] = array(
+                                'parent' => 'my-account-' . $this->id,
+                                'title' => $inbox,
+                                'href' => trailingslashit( $messages_link . 'inbox' )
+                        );
+
+                        // Sent Messages
+                        $wp_admin_nav[] = array(
+                                'parent' => 'my-account-' . $this->id,
+                                'title' => __( 'Sent', 'buddypress' ),
+                                'href' => trailingslashit( $messages_link . 'sent' )
+                        );
+
+                        // Compose Message
+                        $wp_admin_nav[] = array(
+                                'parent' => 'my-account-' . $this->id,
+                                'title' => __( 'Compose', 'buddypress' ),
+                                'href' => trailingslashit( $messages_link . 'compose' )
+                        );
+
+                        // Site Wide Notices
+                        if ( is_super_admin() ) {
+                                $wp_admin_nav[] = array(
+                                        'parent' => 'my-account-' . $this->id,
+                                        'title' => __( 'All Member Notices', 'buddypress' ),
+                                        'href' => trailingslashit( $messages_link . 'notices' )
+                                );
+                        }
+                }
+
+                parent::_setup_admin_bar( $wp_admin_nav );
+        }
+
+        /**
+         * Sets up the title for pages and <title>
+         *
+         * @global obj $bp
+         */
+        function _setup_title() {
+                global $bp;
+
</ins><span class="cx">                 if ( bp_is_messages_component() ) {
</span><span class="cx">                         if ( bp_is_my_profile() ) {
</span><span class="cx">                                 $bp->bp_options_title = __( 'My Messages', 'buddypress' );
</span><span class="lines">@@ -164,7 +241,7 @@
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                parent::_setup_nav( $main_nav, $sub_nav );
</del><ins>+                parent::_setup_title();
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> // Create the messages component
</span></span></pre></div>
<a id="trunkbpsettingsbpsettingsloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-settings/bp-settings-loader.php (4150 => 4151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-settings/bp-settings-loader.php        2011-03-23 21:30:29 UTC (rev 4150)
+++ trunk/bp-settings/bp-settings-loader.php        2011-03-24 05:26:18 UTC (rev 4151)
</span><span class="lines">@@ -115,6 +115,56 @@
</span><span class="cx">
</span><span class="cx">                 parent::_setup_nav( $main_nav, $sub_nav );
</span><span class="cx">         }
</span><ins>+
+        /**
+         * Set up the admin bar
+         *
+         * @global obj $bp
+         */
+        function _setup_admin_bar() {
+                global $bp;
+
+                // "My Account" menu
+                if ( is_user_logged_in() ) {
+
+                        // Setup the logged in user variables
+                        $user_domain = $bp->loggedin_user->domain;
+                        $settings_link = trailingslashit( $user_domain . $this->slug );
+
+                        // Add main Settings menu
+                        $wp_admin_nav[] = array(
+                                'parent' => $bp->my_account_menu_id,
+                                'id' => 'my-account-' . $this->id,
+                                'title' => __( 'Settings', 'buddypress' ),
+                                'href' => trailingslashit( $settings_link )
+                        );
+
+                        // General Account
+                        $wp_admin_nav[] = array(
+                                'parent' => 'my-account-' . $this->id,
+                                'title' => __( 'General', 'buddypress' ),
+                                'href' => trailingslashit( $settings_link . 'general' )
+                        );
+
+                        // Notifications
+                        $wp_admin_nav[] = array(
+                                'parent' => 'my-account-' . $this->id,
+                                'title' => __( 'Notifications', 'buddypress' ),
+                                'href' => trailingslashit( $settings_link . 'notifications' )
+                        );
+
+                        // Delete Account
+                        if ( !is_super_admin() && empty( $bp->site_options['bp-disable-account-deletion'] ) ) {
+                                $wp_admin_nav[] = array(
+                                        'parent' => 'my-account-' . $this->id,
+                                        'title' => __( 'Compose', 'buddypress' ),
+                                        'href' => trailingslashit( $settings_link . 'delete-account' )
+                                );
+                        }
+                }
+
+                parent::_setup_admin_bar( $wp_admin_nav );
+        }
</ins><span class="cx"> }
</span><span class="cx"> // Create the settingss component
</span><span class="cx"> $bp->settings = new BP_Settings_Component();
</span></span></pre></div>
<a id="trunkbpxprofilebpxprofileloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile/bp-xprofile-loader.php (4150 => 4151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile/bp-xprofile-loader.php        2011-03-23 21:30:29 UTC (rev 4150)
+++ trunk/bp-xprofile/bp-xprofile-loader.php        2011-03-24 05:26:18 UTC (rev 4151)
</span><span class="lines">@@ -151,6 +151,54 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         /**
</span><ins>+         * Set up the admin bar
+         *
+         * @global obj $bp
+         */
+        function _setup_admin_bar() {
+                global $bp;
+
+                // Menus for logged in user
+                if ( is_user_logged_in() ) {
+
+                        // Profile link
+                        $profile_link = trailingslashit( $bp->loggedin_user->domain . $this->slug );
+
+                        // Add the "Profile" sub menu
+                        $wp_admin_nav[] = array(
+                                'parent' => $bp->my_account_menu_id,
+                                'id' => 'my-account-' . $this->id,
+                                'title' => __( 'Profile', 'buddypress' ),
+                                'href' => trailingslashit( $profile_link )
+                        );
+
+                        // View Profile
+                        $wp_admin_nav[] = array(
+                                'parent' => 'my-account-' . $this->id,
+                                'title' => __( 'View My Profile', 'buddypress' ),
+                                'href' => trailingslashit( $profile_link . 'public' )
+                        );
+
+                        // Edit Profile
+                        $wp_admin_nav[] = array(
+                                'parent' => 'my-account-' . $this->id,
+                                'title' => __( 'Edit My Profile', 'buddypress' ),
+                                'href' => trailingslashit( $profile_link . 'edit' )
+                        );
+
+                        // Edit Profile
+                        $wp_admin_nav[] = array(
+                                'parent' => 'my-account-' . $this->id,
+                                'title' => __( 'Change My Avatar', 'buddypress' ),
+                                'href' => trailingslashit( $profile_link . 'change-avatar' )
+                        );
+
+                }
+
+                parent::_setup_admin_bar( $wp_admin_nav );
+        }
+
+        /**
</ins><span class="cx">          * Sets up the title for pages and <title>
</span><span class="cx">          *
</span><span class="cx">          * @global obj $bp
</span></span></pre>
</div>
</div>
</body>
</html>