<!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] [2591] trunk: Fixing authors admin menu,
  and removing fallback admin bar css in place of default theme css.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>2591</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-02-04 15:23:48 +0000 (Thu, 04 Feb 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fixing authors admin menu, and removing fallback admin bar css in place of default theme css.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpcorebpcoreadminbarphp">trunk/bp-core/bp-core-adminbar.php</a></li>
<li><a href="#trunkbpcorebpcorecssjsphp">trunk/bp-core/bp-core-cssjs.php</a></li>
<li><a href="#trunkbpthemesbpdefault_inccssadminbarcss">trunk/bp-themes/bp-default/_inc/css/adminbar.css</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkbpcorecssadminbarfallbackcss">trunk/bp-core/css/admin-bar-fallback.css</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 (2590 => 2591)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-adminbar.php        2010-02-04 14:16:58 UTC (rev 2590)
+++ trunk/bp-core/bp-core-adminbar.php        2010-02-04 15:23:48 UTC (rev 2591)
</span><span class="lines">@@ -177,14 +177,15 @@
</span><span class="cx"> 
</span><span class="cx"> // **** &quot;Blog Authors&quot; Menu (visible when not logged in) ********
</span><span class="cx"> function bp_adminbar_authors_menu() {
</span><del>-        global $bp, $current_blog;
</del><ins>+        global $bp, $current_blog, $wpdb;
</ins><span class="cx"> 
</span><del>-        if ( $current_blog-&gt;id == $bp-&gt;root_blog || !function_exists( 'bp_blogs_install' ) )
</del><ins>+        if ( $current_blog-&gt;blog_id == BP_ROOT_BLOG || !function_exists( 'bp_blogs_install' ) )
</ins><span class="cx">                 return false;
</span><span class="cx"> 
</span><del>-        $authors = get_users_of_blog();
</del><ins>+        $blog_prefix = $wpdb-&gt;get_blog_prefix( $current_blog-&gt;id );
+        $authors = $wpdb-&gt;get_results( &quot;SELECT user_id, user_login, user_nicename, display_name, user_email, meta_value as caps FROM $wpdb-&gt;users u, $wpdb-&gt;usermeta um WHERE u.ID = um.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY um.user_id&quot; );
</ins><span class="cx"> 
</span><del>-        if ( is_array( $authors ) ) {
</del><ins>+        if ( !empty( $authors ) ) {
</ins><span class="cx">                 /* This is a blog, render a menu with links to all authors */
</span><span class="cx">                 echo '&lt;li id=&quot;bp-adminbar-authors-menu&quot;&gt;&lt;a href=&quot;/&quot;&gt;';
</span><span class="cx">                 _e('Blog Authors', 'buddypress');
</span><span class="lines">@@ -192,13 +193,12 @@
</span><span class="cx"> 
</span><span class="cx">                 echo '&lt;ul class=&quot;author-list&quot;&gt;';
</span><span class="cx">                 foreach( (array)$authors as $author ) {
</span><del>-                        $author = new BP_Core_User( $author-&gt;user_id );
</del><ins>+                        $caps = maybe_unserialize( $author-&gt;caps );
+                        if ( isset( $caps['subscriber'] ) || isset( $caps['contributor'] ) ) continue;
+
</ins><span class="cx">                         echo '&lt;li&gt;';
</span><del>-
-                        echo '&lt;a href=&quot;' . $author-&gt;user_url . '&quot;&gt;';
-                        echo $author-&gt;avatar_mini;
-                        echo ' ' . $author-&gt;fullname;
-                        echo '&lt;span class=&quot;activity&quot;&gt;' . $author-&gt;last_active . '&lt;/span&gt;';
</del><ins>+                        echo bp_core_fetch_avatar( array( 'item_id' =&gt; $author-&gt;user_id, 'email' =&gt; $author-&gt;user_email, 'width' =&gt; 25, 'height' =&gt; 25 ) ) ;
+                        echo '&lt;a href=&quot;' . bp_core_get_user_domain( $author-&gt;user_id, $author-&gt;user_nicename, $author-&gt;user_login ) . '&quot;&gt;' . $author-&gt;display_name . '&lt;/a&gt;';
</ins><span class="cx">                         echo '&lt;/a&gt;';
</span><span class="cx">                         echo '&lt;div class=&quot;admin-bar-clear&quot;&gt;&lt;/div&gt;';
</span><span class="cx">                         echo '&lt;/li&gt;';
</span></span></pre></div>
<a id="trunkbpcorebpcorecssjsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-cssjs.php (2590 => 2591)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-cssjs.php        2010-02-04 14:16:58 UTC (rev 2590)
+++ trunk/bp-core/bp-core-cssjs.php        2010-02-04 15:23:48 UTC (rev 2591)
</span><span class="lines">@@ -14,12 +14,16 @@
</span><span class="cx">         if ( defined( 'BP_DISABLE_ADMIN_BAR' ) )
</span><span class="cx">                 return false;
</span><span class="cx"> 
</span><del>-        /* Check there is admin bar css in the currently active theme. If not fallback to the css in the plugin. */
-        if ( !locate_template( array( '_inc/css/adminbar.css' ), false ) )
-                wp_enqueue_style( 'bp-admin-bar', apply_filters( 'bp_core_admin_bar_css', BP_PLUGIN_URL . '/bp-core/css/admin-bar-fallback.css' ) );
-        else {
-                if ( is_admin() )
-                        wp_enqueue_style( 'bp-admin-bar', apply_filters( 'bp_core_admin_bar_css', str_replace( ABSPATH, $bp-&gt;root_domain . '/', locate_template( array( '_inc/css/adminbar.css' ), false ) ) ) );
</del><ins>+        if ( !bp_core_is_multisite() )
+                return false;
+
+        if ( $bp-&gt;current_blog != BP_ROOT_BLOG ) {
+                $stylesheet = get_blog_option( BP_ROOT_BLOG, 'stylesheet' );
+
+                if ( file_exists( WP_CONTENT_DIR . '/themes/' . $stylesheet . '/_inc/css/adminbar.css' ) )
+                        wp_enqueue_style( 'bp-admin-bar', apply_filters( 'bp_core_admin_bar_css', WP_CONTENT_URL . '/themes/' . $stylesheet . '/_inc/css/adminbar.css' ) );
+                else
+                        wp_enqueue_style( 'bp-admin-bar', apply_filters( 'bp_core_admin_bar_css', BP_PLUGIN_URL . '/bp-themes/bp-default/_inc/css/adminbar.css' ) );
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> add_action( 'init', 'bp_core_add_admin_bar_css' );
</span><span class="lines">@@ -44,6 +48,10 @@
</span><span class="cx"> add_action( 'admin_head', 'bp_core_admin_menu_icon_css' );
</span><span class="cx"> 
</span><span class="cx"> function bp_core_confirmation_js() {
</span><ins>+        global $current_blog;
+
+        if ( $current_blog-&gt;blog_id != BP_ROOT_BLOG )
+                return false;
</ins><span class="cx"> ?&gt;
</span><span class="cx">         &lt;script type=&quot;text/javascript&quot;&gt; jQuery(document).ready( function() { jQuery(&quot;a.confirm&quot;).click( function() { if ( confirm( '&lt;?php _e( 'Are you sure?', 'buddypress' ) ?&gt;' ) ) return true; else return false; }); });&lt;/script&gt;
</span><span class="cx"> &lt;?php
</span></span></pre></div>
<a id="trunkbpcorecssadminbarfallbackcss"></a>
<div class="delfile"><h4>Deleted: trunk/bp-core/css/admin-bar-fallback.css (2590 => 2591)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/css/admin-bar-fallback.css        2010-02-04 14:16:58 UTC (rev 2590)
+++ trunk/bp-core/css/admin-bar-fallback.css        2010-02-04 15:23:48 UTC (rev 2591)
</span><span class="lines">@@ -1,192 +0,0 @@
</span><del>-/* This CSS will only be loaded if an _inc/css/admin-bar.css file does not exist
- * within the active theme for the root/main blog.
- */
-
-body {
-        padding-top: 25px;
-}
-
-#wp-admin-bar {
-        position: fixed;
-        top: 0;
-        left: 0;
-        z-index: 99;
-        height: 25px;
-        font-size: 11px;
-        width: 100%;
-        background: #666;
-}
-
-#wp-admin-bar * { z-index: 999; }
-
-#wp-admin-bar div#admin-bar-logo {
-        position: absolute;
-        top: 5px;
-        left: 10px;
-}
-
-#wp-admin-bar a img {
-        border: none;
-}
-
-#wp-admin-bar li {
-        list-style: none;
-        margin: 0;
-        padding: 0;
-        line-height: 100%;
-        text-align: left;
-}
-
-#wp-admin-bar li a {
-        padding: 5px 15px 8px 15px;
-        color: #fff;
-        text-decoration: none;
-        color: #f0f0f0;
-        font-size: 11px;
-}
-        #wp-admin-bar li.no-arrow a {
-                padding-right: 15px;
-        }
-
-        #wp-admin-bar li a span {
-                background: #fff;
-                padding: 2px 5px;
-                color: #555;
-                -moz-border-radius: 3px;
-                -webkit-border-radius: 3px;
-                border-radius: 3px;
-        }
-
-#wp-admin-bar li:hover, #wp-admin-bar li.hover {
-        position: static;
-}
-
-#wp-admin-bar li.alt {
-        border: none;
-}
-        #wp-admin-bar ul li ul li a span {
-                display: none;
-        }
-
-#admin-bar-logo {
-        float: left;
-        font-weight: bold;
-        font-size: 11px;
-        padding: 3px 8px;
-        margin: 0;
-        text-decoration: none;
-        color: #f0f0f0;
-}
-
-/*******************/
-
-#wp-admin-bar ul { /* all lists */
-        margin: 0;
-        list-style: none;
-        line-height: 1;
-        cursor: pointer;
-        height: auto;
-        padding: 0;
-}
-
-#wp-admin-bar ul li { /* all list items */
-        padding: 0;
-        float: left;
-        position: relative;
-}
-        #wp-admin-bar ul li.no-arrow {
-                background: none;
-        }
-
-        #wp-admin-bar ul li ul li {
-                background-image: none;
-        }
-
-#wp-admin-bar ul li.align-right {
-        position: absolute;
-        right: 0;
-}
-
-#wp-admin-bar ul li a {
-        display: block;
-        margin: 0;
-}
-
-#wp-admin-bar ul.main-nav li:hover, #wp-admin-bar ul.main-nav li.sfhover, #wp-admin-bar ul.main-nav li ul li.sfhover {
-        background-color: #555;
-}
-
-/* second-level lists */
-
-#wp-admin-bar ul li ul {
-        position: absolute;
-        width: 185px;
-        left: -999em;
-        margin-left: 0;
-        background: #fff;
-        border: 1px solid #ddd;
-        -moz-border-radius: 3px;
-        -webkit-border-radius: 3px;
-}
-        #wp-admin-bar ul li ul a {
-                color: #888;
-        }
-
-#wp-admin-bar ul li ul li {
-        float: left;
-        width: 185px;
-        margin: 0;
-}
-        #wp-admin-bar ul li ul li:hover a {
-                color: #fff;
-        }
-
-#wp-admin-bar ul li div.admin-bar-clear {
-        clear: both;
-}
-
-/* third-and-above-level lists */
-
-#wp-admin-bar ul li ul ul {
-        margin: -25px 0 0 184px;
-}
-        #wp-admin-bar ul li ul li:hover ul li a {
-                color: #555;
-        }
-                #wp-admin-bar ul li ul li ul li:hover a {
-                        color: #fff;
-                }
-
-#wp-admin-bar ul li:hover ul, #wp-admin-bar ul li ul li:hover ul, #wp-admin-bar ul li.sfhover ul, #wp-admin-bar ul li ul li.sfhover ul  { /* lists nested under hovered list items */
-        left: auto;
-}
-
-#wp-admin-bar ul li.align-right:hover ul {
-        right: 0;
-}
-
-#wp-admin-bar ul li:hover ul ul, #wp-admin-bar li.sfhover ul li ul {
-        left: -999em;
-}
-
-/* Menu item css */
-
-#wp-admin-bar img.avatar {
-        float: left;
-        margin-right: 8px;
-}
-
-#wp-admin-bar span.activity {
-        display: block;
-        margin-left: 34px;
-        padding: 0;
-}
-
-#wp-admin-bar ul.author-list li {
-        height: 55px;
-}
-
-#wp-admin-bar ul li#bp-adminbar-notifications-menu a span {
-        padding: 0 6px;
-        margin-left: 2px;
-}
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkbpthemesbpdefault_inccssadminbarcss"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/_inc/css/adminbar.css (2590 => 2591)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/_inc/css/adminbar.css        2010-02-04 14:16:58 UTC (rev 2590)
+++ trunk/bp-themes/bp-default/_inc/css/adminbar.css        2010-02-04 15:23:48 UTC (rev 2591)
</span><span class="lines">@@ -184,7 +184,8 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #wp-admin-bar ul.author-list li {
</span><del>-        height: 55px;
</del><ins>+        padding: 10px;
+        height: 30px;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #wp-admin-bar ul li#bp-adminbar-notifications-menu a span {
</span></span></pre>
</div>
</div>

</body>
</html>