<!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" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { 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 #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#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>
<title>[BuddyPress] [3415] trunk/bp-core/bp-core-adminbar.php:
Merge bp-core-adminbar.php changes into trunk</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>3415</dd>
<dt>Author</dt> <dd>johnjamesjacoby</dd>
<dt>Date</dt> <dd>2010-11-14 04:58:27 +0000 (Sun, 14 Nov 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge bp-core-adminbar.php changes into trunk</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpcorebpcoreadminbarphp">trunk/bp-core/bp-core-adminbar.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpcorebpcoreadminbarphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-adminbar.php (3414 => 3415)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-adminbar.php        2010-11-14 04:52:49 UTC (rev 3414)
+++ trunk/bp-core/bp-core-adminbar.php        2010-11-14 04:58:27 UTC (rev 3415)
</span><span class="lines">@@ -6,7 +6,7 @@
</span><span class="cx">         if ( defined( 'BP_DISABLE_ADMIN_BAR' ) )
</span><span class="cx">                 return false;
</span><span class="cx">
</span><del>-        if ( isset( $bp->site_options['hide-loggedout-adminbar'] ) && (int)$bp->site_options['hide-loggedout-adminbar'] && !is_user_logged_in() )
</del><ins>+        if ( (int)get_site_option( 'hide-loggedout-adminbar' ) && !is_user_logged_in() )
</ins><span class="cx">                 return false;
</span><span class="cx">
</span><span class="cx">         $bp->doing_admin_bar = true;
</span><span class="lines">@@ -44,9 +44,8 @@
</span><span class="cx">         echo '<li class="bp-login no-arrow"><a href="' . $bp->root_domain . '/wp-login.php?redirect_to=' . urlencode( $bp->root_domain ) . '">' . __( 'Log In', 'buddypress' ) . '</a></li>';
</span><span class="cx">
</span><span class="cx">         // Show "Sign Up" link if user registrations are allowed
</span><del>-        if ( bp_get_signup_allowed() ) {
</del><ins>+        if ( bp_get_signup_allowed() )
</ins><span class="cx">                 echo '<li class="bp-signup no-arrow"><a href="' . bp_get_signup_page(false) . '">' . __( 'Sign Up', 'buddypress' ) . '</a></li>';
</span><del>-        }
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -75,15 +74,8 @@
</span><span class="cx">                         $sub_counter = 0;
</span><span class="cx">
</span><span class="cx">                         foreach( (array)$bp->bp_options_nav[$nav_item['slug']] as $subnav_item ) {
</span><del>-                                $link = $subnav_item['link'];
-                                $name = $subnav_item['name'];
-
-                                if ( isset( $bp->displayed_user->domain ) )
-                                        $link = str_replace( $bp->displayed_user->domain, $bp->loggedin_user->domain, $subnav_item['link'] );
-
-                                if ( isset( $bp->displayed_user->userdata->user_login ) )
-                                        $name = str_replace( $bp->displayed_user->userdata->user_login, $bp->loggedin_user->userdata->user_login, $subnav_item['name'] );
-
</del><ins>+                                $link = str_replace( $bp->displayed_user->domain, $bp->loggedin_user->domain, $subnav_item['link'] );
+                                $name = str_replace( $bp->displayed_user->userdata->user_login, $bp->loggedin_user->userdata->user_login, $subnav_item['name'] );
</ins><span class="cx">                                 $alt = ( 0 == $sub_counter % 2 ) ? ' class="alt"' : '';
</span><span class="cx">                                 echo '<li' . $alt . '><a id="bp-admin-' . $subnav_item['css_id'] . '" href="' . $link . '">' . $name . '</a></li>';
</span><span class="cx">                                 $sub_counter++;
</span><span class="lines">@@ -107,9 +99,12 @@
</span><span class="cx"> function bp_adminbar_blogs_menu() {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><del>-        if ( !is_user_logged_in() || !function_exists('bp_blogs_install') )
</del><ins>+        if ( !is_user_logged_in() || !bp_is_active( 'blogs' ) )
</ins><span class="cx">                 return false;
</span><span class="cx">
</span><ins>+        if ( !is_multisite() )
+                return false;
+
</ins><span class="cx">         if ( !$blogs = wp_cache_get( 'bp_blogs_of_user_' . $bp->loggedin_user->id . '_inc_hidden', 'bp' ) ) {
</span><span class="cx">                 $blogs = bp_blogs_get_blogs_for_user( $bp->loggedin_user->id, true );
</span><span class="cx">                 wp_cache_set( 'bp_blogs_of_user_' . $bp->loggedin_user->id . '_inc_hidden', $blogs, 'bp' );
</span><span class="lines">@@ -130,7 +125,6 @@
</span><span class="cx">
</span><span class="cx">                         echo '<li' . $alt . '>';
</span><span class="cx">                         echo '<a href="' . $site_url . '">' . esc_html( $blog->name ) . '</a>';
</span><del>-
</del><span class="cx">                         echo '<ul>';
</span><span class="cx">                         echo '<li class="alt"><a href="' . $site_url . 'wp-admin/">' . __( 'Dashboard', 'buddypress' ) . '</a></li>';
</span><span class="cx">                         echo '<li><a href="' . $site_url . 'wp-admin/post-new.php">' . __( 'New Post', 'buddypress' ) . '</a></li>';
</span><span class="lines">@@ -160,18 +154,18 @@
</span><span class="cx"> function bp_adminbar_thisblog_menu() {
</span><span class="cx">         if ( current_user_can( 'edit_posts' ) ) {
</span><span class="cx">                 echo '<li id="bp-adminbar-thisblog-menu"><a href="' . admin_url() . '">';
</span><del>-                
</del><ins>+
</ins><span class="cx">                 _e( 'Dashboard', 'buddypress' );
</span><del>-        
</del><ins>+
</ins><span class="cx">                 echo '</a>';
</span><span class="cx">                 echo '<ul>';
</span><del>-                
</del><ins>+
</ins><span class="cx">                 echo '<li class="alt"><a href="' . admin_url() . 'post-new.php">' . __( 'New Post', 'buddypress' ) . '</a></li>';
</span><del>-                echo '<li class="alt"><a href="' . admin_url() . 'edit.php">' . __( 'Manage Posts', 'buddypress' ) . '</a></li>';
</del><ins>+                echo '<li><a href="' . admin_url() . 'edit.php">' . __( 'Manage Posts', 'buddypress' ) . '</a></li>';
</ins><span class="cx">                 echo '<li class="alt"><a href="' . admin_url() . 'edit-comments.php">' . __( 'Manage Comments', 'buddypress' ) . '</a></li>';
</span><del>-                
</del><ins>+
</ins><span class="cx">                 do_action( 'bp_adminbar_thisblog_items' );
</span><del>-                
</del><ins>+
</ins><span class="cx">                 echo '</ul>';
</span><span class="cx">                 echo '</li>';
</span><span class="cx">         }
</span><span class="lines">@@ -188,22 +182,26 @@
</span><span class="cx">         _e( 'Notifications', 'buddypress' );
</span><span class="cx">
</span><span class="cx">         if ( $notifications = bp_core_get_notifications_for_user( $bp->loggedin_user->id ) ) { ?>
</span><del>-                <span><?php echo count($notifications) ?></span>
</del><ins>+                <span><?php echo count( $notifications ) ?></span>
</ins><span class="cx">         <?php
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         echo '</a>';
</span><span class="cx">         echo '<ul>';
</span><span class="cx">
</span><del>-        if ( $notifications ) { ?>
-                <?php $counter = 0; ?>
-                <?php for ( $i = 0; $i < count($notifications); $i++ ) { ?>
-                        <?php $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; ?>
</del><ins>+        if ( $notifications ) {
+                $counter = 0;
+                for ( $i = 0; $i < count($notifications); $i++ ) {
+                        $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; ?>
+
</ins><span class="cx">                         <li<?php echo $alt ?>><?php echo $notifications[$i] ?></li>
</span><del>-                        <?php $counter++; ?>
-                <?php } ?>
-        <?php } else { ?>
</del><ins>+
+                        <?php $counter++;
+                }
+        } else { ?>
+
</ins><span class="cx">                 <li><a href="<?php echo $bp->loggedin_user->domain ?>"><?php _e( 'No new notifications.', 'buddypress' ); ?></a></li>
</span><ins>+
</ins><span class="cx">         <?php
</span><span class="cx">         }
</span><span class="cx">
</span><span class="lines">@@ -215,14 +213,19 @@
</span><span class="cx"> function bp_adminbar_authors_menu() {
</span><span class="cx">         global $bp, $current_blog, $wpdb;
</span><span class="cx">
</span><del>-        if ( $current_blog->blog_id == BP_ROOT_BLOG || !function_exists( 'bp_blogs_install' ) )
</del><ins>+        // Only for multisite
+        if ( !is_multisite() )
</ins><span class="cx">                 return false;
</span><span class="cx">
</span><ins>+        // Hide on root blog
+        if ( $current_blog->blog_id == BP_ROOT_BLOG || !bp_is_active( 'blogs' ) )
+                return false;
+
</ins><span class="cx">         $blog_prefix = $wpdb->get_blog_prefix( $current_blog->id );
</span><del>-        $authors = $wpdb->get_results( "SELECT user_id, user_login, user_nicename, display_name, user_email, meta_value as caps FROM $wpdb->users u, $wpdb->usermeta um WHERE u.ID = um.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY um.user_id" );
</del><ins>+        $authors = $wpdb->get_results( "SELECT user_id, user_login, user_nicename, display_name, user_email, meta_value as caps FROM $wpdb->users u, $wpdb->usermeta um WHERE u.ID = um.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY um.user_id" );
</ins><span class="cx">
</span><span class="cx">         if ( !empty( $authors ) ) {
</span><del>-                /* This is a blog, render a menu with links to all authors */
</del><ins>+                // This is a blog, render a menu with links to all authors
</ins><span class="cx">                 echo '<li id="bp-adminbar-authors-menu"><a href="/">';
</span><span class="cx">                 _e('Blog Authors', 'buddypress');
</span><span class="cx">                 echo '</a>';
</span><span class="lines">@@ -247,43 +250,44 @@
</span><span class="cx"> // **** "Random" Menu (visible when not logged in) ********
</span><span class="cx"> function bp_adminbar_random_menu() {
</span><span class="cx">         global $bp; ?>
</span><ins>+
</ins><span class="cx">         <li class="align-right" id="bp-adminbar-visitrandom-menu">
</span><span class="cx">                 <a href="#"><?php _e( 'Visit', 'buddypress' ) ?></a>
</span><span class="cx">                 <ul class="random-list">
</span><del>-                        <li><a href="<?php echo $bp->root_domain . '/' . $bp->members->slug . '/?random-member' ?>"><?php _e( 'Random Member', 'buddypress' ) ?></a></li>
</del><ins>+                        <li><a href="<?php echo $bp->root_domain . '/' . BP_MEMBERS_SLUG . '/?random-member' ?>"><?php _e( 'Random Member', 'buddypress' ) ?></a></li>
</ins><span class="cx">
</span><span class="cx">                         <?php if ( bp_is_active( 'groups' ) ) : ?>
</span><del>-                        <li class="alt"><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug . '/?random-group' ?>"><?php _e( 'Random Group', 'buddypress' ) ?></a></li>
</del><ins>+
+                                <li class="alt"><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug . '/?random-group' ?>"><?php _e( 'Random Group', 'buddypress' ) ?></a></li>
+
</ins><span class="cx">                         <?php endif; ?>
</span><span class="cx">
</span><span class="cx">                         <?php if ( bp_is_active( 'blogs' ) && is_multisite() ) : ?>
</span><del>-                        <li><a href="<?php echo $bp->root_domain . '/' . $bp->blogs->slug . '/?random-blog' ?>"><?php _e( 'Random Blog', 'buddypress' ) ?></a></li>
</del><span class="cx">
</span><ins>+                                <li><a href="<?php echo $bp->root_domain . '/' . $bp->blogs->slug . '/?random-blog' ?>"><?php _e( 'Random Blog', 'buddypress' ) ?></a></li>
+
</ins><span class="cx">                         <?php endif; ?>
</span><span class="cx">
</span><span class="cx">                         <?php do_action( 'bp_adminbar_random_menu' ) ?>
</span><ins>+
</ins><span class="cx">                 </ul>
</span><span class="cx">         </li>
</span><ins>+
</ins><span class="cx">         <?php
</span><span class="cx"> }
</span><span class="cx">
</span><del>-add_action( 'bp_adminbar_logo', 'bp_adminbar_logo' );
-add_action( 'bp_adminbar_menus', 'bp_adminbar_login_menu', 2 );
-add_action( 'bp_adminbar_menus', 'bp_adminbar_account_menu', 4 );
</del><ins>+// Actions used to build the admin bar
+add_action( 'bp_adminbar_logo', 'bp_adminbar_logo' );
+add_action( 'bp_adminbar_menus', 'bp_adminbar_login_menu', 2 );
+add_action( 'bp_adminbar_menus', 'bp_adminbar_account_menu', 4 );
+add_action( 'bp_adminbar_menus', 'bp_adminbar_blogs_menu', 6 );
+add_action( 'bp_adminbar_menus', 'bp_adminbar_thisblog_menu', 6 );
+add_action( 'bp_adminbar_menus', 'bp_adminbar_notifications_menu', 8 );
+add_action( 'bp_adminbar_menus', 'bp_adminbar_authors_menu', 12 );
+add_action( 'bp_adminbar_menus', 'bp_adminbar_random_menu', 100 );
</ins><span class="cx">
</span><del>-if ( is_multisite() )
-        add_action( 'bp_adminbar_menus', 'bp_adminbar_blogs_menu', 6 );
-else
-        add_action( 'bp_adminbar_menus', 'bp_adminbar_thisblog_menu', 6 );
</del><ins>+// Actions used to append admin bar to footer
+add_action( 'wp_footer', 'bp_core_admin_bar', 8 );
+add_action( 'admin_footer', 'bp_core_admin_bar' );
</ins><span class="cx">
</span><del>-add_action( 'bp_adminbar_menus', 'bp_adminbar_notifications_menu', 8 );
-
-if ( is_multisite() )
-        add_action( 'bp_adminbar_menus', 'bp_adminbar_authors_menu', 12 );
-
-add_action( 'bp_adminbar_menus', 'bp_adminbar_random_menu', 100 );
-
-add_action( 'wp_footer', 'bp_core_admin_bar', 8 );
-add_action( 'admin_footer', 'bp_core_admin_bar' );
-
</del><span class="cx"> ?>
</span><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>
</body>
</html>