Changeset 3415
- Timestamp:
- 11/14/2010 04:58:27 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-adminbar.php
r3405 r3415 7 7 return false; 8 8 9 if ( isset( $bp->site_options['hide-loggedout-adminbar'] ) && (int)$bp->site_options['hide-loggedout-adminbar']&& !is_user_logged_in() )9 if ( (int)get_site_option( 'hide-loggedout-adminbar' ) && !is_user_logged_in() ) 10 10 return false; 11 11 … … 45 45 46 46 // Show "Sign Up" link if user registrations are allowed 47 if ( bp_get_signup_allowed() ) {47 if ( bp_get_signup_allowed() ) 48 48 echo '<li class="bp-signup no-arrow"><a href="' . bp_get_signup_page(false) . '">' . __( 'Sign Up', 'buddypress' ) . '</a></li>'; 49 }50 49 } 51 50 … … 76 75 77 76 foreach( (array)$bp->bp_options_nav[$nav_item['slug']] as $subnav_item ) { 78 $link = $subnav_item['link']; 79 $name = $subnav_item['name']; 80 81 if ( isset( $bp->displayed_user->domain ) ) 82 $link = str_replace( $bp->displayed_user->domain, $bp->loggedin_user->domain, $subnav_item['link'] ); 83 84 if ( isset( $bp->displayed_user->userdata->user_login ) ) 85 $name = str_replace( $bp->displayed_user->userdata->user_login, $bp->loggedin_user->userdata->user_login, $subnav_item['name'] ); 86 77 $link = str_replace( $bp->displayed_user->domain, $bp->loggedin_user->domain, $subnav_item['link'] ); 78 $name = str_replace( $bp->displayed_user->userdata->user_login, $bp->loggedin_user->userdata->user_login, $subnav_item['name'] ); 87 79 $alt = ( 0 == $sub_counter % 2 ) ? ' class="alt"' : ''; 88 80 echo '<li' . $alt . '><a id="bp-admin-' . $subnav_item['css_id'] . '" href="' . $link . '">' . $name . '</a></li>'; … … 108 100 global $bp; 109 101 110 if ( !is_user_logged_in() || !function_exists('bp_blogs_install') ) 102 if ( !is_user_logged_in() || !bp_is_active( 'blogs' ) ) 103 return false; 104 105 if ( !is_multisite() ) 111 106 return false; 112 107 … … 131 126 echo '<li' . $alt . '>'; 132 127 echo '<a href="' . $site_url . '">' . esc_html( $blog->name ) . '</a>'; 133 134 128 echo '<ul>'; 135 129 echo '<li class="alt"><a href="' . $site_url . 'wp-admin/">' . __( 'Dashboard', 'buddypress' ) . '</a></li>'; … … 161 155 if ( current_user_can( 'edit_posts' ) ) { 162 156 echo '<li id="bp-adminbar-thisblog-menu"><a href="' . admin_url() . '">'; 163 157 164 158 _e( 'Dashboard', 'buddypress' ); 165 159 166 160 echo '</a>'; 167 161 echo '<ul>'; 168 162 169 163 echo '<li class="alt"><a href="' . admin_url() . 'post-new.php">' . __( 'New Post', 'buddypress' ) . '</a></li>'; 170 echo '<li class="alt"><a href="' . admin_url() . 'edit.php">' . __( 'Manage Posts', 'buddypress' ) . '</a></li>';164 echo '<li><a href="' . admin_url() . 'edit.php">' . __( 'Manage Posts', 'buddypress' ) . '</a></li>'; 171 165 echo '<li class="alt"><a href="' . admin_url() . 'edit-comments.php">' . __( 'Manage Comments', 'buddypress' ) . '</a></li>'; 172 166 173 167 do_action( 'bp_adminbar_thisblog_items' ); 174 168 175 169 echo '</ul>'; 176 170 echo '</li>'; … … 189 183 190 184 if ( $notifications = bp_core_get_notifications_for_user( $bp->loggedin_user->id ) ) { ?> 191 <span><?php echo count( $notifications) ?></span>185 <span><?php echo count( $notifications ) ?></span> 192 186 <?php 193 187 } … … 196 190 echo '<ul>'; 197 191 198 if ( $notifications ) { ?> 199 <?php $counter = 0; ?> 200 <?php for ( $i = 0; $i < count($notifications); $i++ ) { ?> 201 <?php $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; ?> 192 if ( $notifications ) { 193 $counter = 0; 194 for ( $i = 0; $i < count($notifications); $i++ ) { 195 $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; ?> 196 202 197 <li<?php echo $alt ?>><?php echo $notifications[$i] ?></li> 203 <?php $counter++; ?> 204 <?php } ?> 205 <?php } else { ?> 198 199 <?php $counter++; 200 } 201 } else { ?> 202 206 203 <li><a href="<?php echo $bp->loggedin_user->domain ?>"><?php _e( 'No new notifications.', 'buddypress' ); ?></a></li> 204 207 205 <?php 208 206 } … … 216 214 global $bp, $current_blog, $wpdb; 217 215 218 if ( $current_blog->blog_id == BP_ROOT_BLOG || !function_exists( 'bp_blogs_install' ) ) 216 // Only for multisite 217 if ( !is_multisite() ) 218 return false; 219 220 // Hide on root blog 221 if ( $current_blog->blog_id == BP_ROOT_BLOG || !bp_is_active( 'blogs' ) ) 219 222 return false; 220 223 221 224 $blog_prefix = $wpdb->get_blog_prefix( $current_blog->id ); 222 $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" );225 $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" ); 223 226 224 227 if ( !empty( $authors ) ) { 225 / * This is a blog, render a menu with links to all authors */228 // This is a blog, render a menu with links to all authors 226 229 echo '<li id="bp-adminbar-authors-menu"><a href="/">'; 227 230 _e('Blog Authors', 'buddypress'); … … 248 251 function bp_adminbar_random_menu() { 249 252 global $bp; ?> 253 250 254 <li class="align-right" id="bp-adminbar-visitrandom-menu"> 251 255 <a href="#"><?php _e( 'Visit', 'buddypress' ) ?></a> 252 256 <ul class="random-list"> 253 <li><a href="<?php echo $bp->root_domain . '/' . $bp->members->slug. '/?random-member' ?>"><?php _e( 'Random Member', 'buddypress' ) ?></a></li>257 <li><a href="<?php echo $bp->root_domain . '/' . BP_MEMBERS_SLUG . '/?random-member' ?>"><?php _e( 'Random Member', 'buddypress' ) ?></a></li> 254 258 255 259 <?php if ( bp_is_active( 'groups' ) ) : ?> 256 <li class="alt"><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug . '/?random-group' ?>"><?php _e( 'Random Group', 'buddypress' ) ?></a></li> 260 261 <li class="alt"><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug . '/?random-group' ?>"><?php _e( 'Random Group', 'buddypress' ) ?></a></li> 262 257 263 <?php endif; ?> 258 264 259 265 <?php if ( bp_is_active( 'blogs' ) && is_multisite() ) : ?> 260 <li><a href="<?php echo $bp->root_domain . '/' . $bp->blogs->slug . '/?random-blog' ?>"><?php _e( 'Random Blog', 'buddypress' ) ?></a></li> 266 267 <li><a href="<?php echo $bp->root_domain . '/' . $bp->blogs->slug . '/?random-blog' ?>"><?php _e( 'Random Blog', 'buddypress' ) ?></a></li> 261 268 262 269 <?php endif; ?> 263 270 264 271 <?php do_action( 'bp_adminbar_random_menu' ) ?> 272 265 273 </ul> 266 274 </li> 275 267 276 <?php 268 277 } 269 278 270 add_action( 'bp_adminbar_logo', 'bp_adminbar_logo' ); 271 add_action( 'bp_adminbar_menus', 'bp_adminbar_login_menu', 2 ); 272 add_action( 'bp_adminbar_menus', 'bp_adminbar_account_menu', 4 ); 273 274 if ( is_multisite() ) 275 add_action( 'bp_adminbar_menus', 'bp_adminbar_blogs_menu', 6 ); 276 else 277 add_action( 'bp_adminbar_menus', 'bp_adminbar_thisblog_menu', 6 ); 278 279 add_action( 'bp_adminbar_menus', 'bp_adminbar_notifications_menu', 8 ); 280 281 if ( is_multisite() ) 282 add_action( 'bp_adminbar_menus', 'bp_adminbar_authors_menu', 12 ); 283 284 add_action( 'bp_adminbar_menus', 'bp_adminbar_random_menu', 100 ); 285 286 add_action( 'wp_footer', 'bp_core_admin_bar', 8 ); 287 add_action( 'admin_footer', 'bp_core_admin_bar' ); 279 // Actions used to build the admin bar 280 add_action( 'bp_adminbar_logo', 'bp_adminbar_logo' ); 281 add_action( 'bp_adminbar_menus', 'bp_adminbar_login_menu', 2 ); 282 add_action( 'bp_adminbar_menus', 'bp_adminbar_account_menu', 4 ); 283 add_action( 'bp_adminbar_menus', 'bp_adminbar_blogs_menu', 6 ); 284 add_action( 'bp_adminbar_menus', 'bp_adminbar_thisblog_menu', 6 ); 285 add_action( 'bp_adminbar_menus', 'bp_adminbar_notifications_menu', 8 ); 286 add_action( 'bp_adminbar_menus', 'bp_adminbar_authors_menu', 12 ); 287 add_action( 'bp_adminbar_menus', 'bp_adminbar_random_menu', 100 ); 288 289 // Actions used to append admin bar to footer 290 add_action( 'wp_footer', 'bp_core_admin_bar', 8 ); 291 add_action( 'admin_footer', 'bp_core_admin_bar' ); 288 292 289 293 ?>
Note: See TracChangeset
for help on using the changeset viewer.