Changeset 9470
- Timestamp:
- 02/10/2015 01:09:09 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/deprecated/2.1.php
r9468 r9470 97 97 */ 98 98 function bp_adminbar_blogs_menu() { 99 global $bp; 100 101 if ( !is_user_logged_in() || !bp_is_active( 'blogs' ) ) 102 return false; 103 104 if ( !is_multisite() ) 105 return false; 99 100 if ( ! is_user_logged_in() || ! bp_is_active( 'blogs' ) ) { 101 return false; 102 } 103 104 if ( ! is_multisite() ) { 105 return false; 106 } 106 107 107 108 $blogs = wp_cache_get( 'bp_blogs_of_user_' . bp_loggedin_user_id() . '_inc_hidden', 'bp' ); … … 192 193 */ 193 194 function bp_core_admin_bar() { 194 global $bp; 195 196 if ( defined( 'BP_DISABLE_ADMIN_BAR' ) && BP_DISABLE_ADMIN_BAR ) 197 return false; 198 199 if ( (int) bp_get_option( 'hide-loggedout-adminbar' ) && !is_user_logged_in() ) 200 return false; 195 $bp = buddypress(); 196 197 if ( defined( 'BP_DISABLE_ADMIN_BAR' ) && BP_DISABLE_ADMIN_BAR ) { 198 return false; 199 } 200 201 if ( (int) bp_get_option( 'hide-loggedout-adminbar' ) && !is_user_logged_in() ) { 202 return false; 203 } 201 204 202 205 $bp->doing_admin_bar = true; … … 238 241 function bp_adminbar_login_menu() { 239 242 240 if ( is_user_logged_in() ) 241 return false; 243 if ( is_user_logged_in() ) { 244 return false; 245 } 242 246 243 247 echo '<li class="bp-login no-arrow"><a href="' . wp_login_url() . '">' . __( 'Log In', 'buddypress' ) . '</a></li>'; 244 248 245 249 // Show "Sign Up" link if user registrations are allowed 246 if ( bp_get_signup_allowed() ) 250 if ( bp_get_signup_allowed() ) { 247 251 echo '<li class="bp-signup no-arrow"><a href="' . bp_get_signup_page() . '">' . __( 'Sign Up', 'buddypress' ) . '</a></li>'; 252 } 248 253 } 249 254 … … 256 261 */ 257 262 function bp_adminbar_account_menu() { 258 global $bp; 259 260 if ( !$bp->bp_nav || !is_user_logged_in() ) 261 return false; 263 $bp = buddypress(); 264 265 if ( empty( $bp->bp_nav ) || ! is_user_logged_in() ) { 266 return false; 267 } 262 268 263 269 echo '<li id="bp-adminbar-account-menu"><a href="' . bp_loggedin_user_domain() . '">'; … … 270 276 $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; 271 277 272 if ( -1 == $nav_item['position'] ) 278 if ( -1 == $nav_item['position'] ) { 273 279 continue; 280 } 274 281 275 282 echo '<li' . $alt . '>'; … … 284 291 $name = $subnav_item['name']; 285 292 286 if ( bp_displayed_user_domain() ) 293 if ( bp_displayed_user_domain() ) { 287 294 $link = str_replace( bp_displayed_user_domain(), bp_loggedin_user_domain(), $subnav_item['link'] ); 288 289 if ( isset( $bp->displayed_user->userdata->user_login ) ) 295 } 296 297 if ( isset( $bp->displayed_user->userdata->user_login ) ) { 290 298 $name = str_replace( $bp->displayed_user->userdata->user_login, $bp->loggedin_user->userdata->user_login, $subnav_item['name'] ); 299 } 291 300 292 301 $alt = ( 0 == $sub_counter % 2 ) ? ' class="alt"' : ''; … … 368 377 */ 369 378 function bp_core_load_buddybar_css() { 370 if ( bp_use_wp_admin_bar() || ( (int) bp_get_option( 'hide-loggedout-adminbar' ) && !is_user_logged_in() ) || ( defined( 'BP_DISABLE_ADMIN_BAR' ) && BP_DISABLE_ADMIN_BAR ) ) 379 380 if ( bp_use_wp_admin_bar() || ( (int) bp_get_option( 'hide-loggedout-adminbar' ) && !is_user_logged_in() ) || ( defined( 'BP_DISABLE_ADMIN_BAR' ) && BP_DISABLE_ADMIN_BAR ) ) { 371 381 return; 382 } 372 383 373 384 $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; … … 394 405 * 395 406 * @deprecated BuddyPress (2.1.0) 396 *397 * @global BuddyPress $bp398 407 */ 399 408 function bp_groups_adminbar_admin_menu() { 400 global $bp; 401 402 if ( empty( $bp->groups->current_group ) ) 403 return false; 409 $bp = buddypress(); 410 411 if ( empty( $bp->groups->current_group ) ) { 412 return false; 413 } 404 414 405 415 // Only group admins and site admins can see this menu 406 if ( !current_user_can( 'edit_users' ) && !bp_current_user_can( 'bp_moderate' ) && !bp_is_item_admin() ) 407 return false; ?> 416 if ( !current_user_can( 'edit_users' ) && !bp_current_user_can( 'bp_moderate' ) && !bp_is_item_admin() ) { 417 return false; 418 } ?> 408 419 409 420 <li id="bp-adminbar-adminoptions-menu"> … … 471 482 472 483 // Only for multisite 473 if ( !is_multisite() ) 474 return false; 484 if ( ! is_multisite() ) { 485 return false; 486 } 475 487 476 488 // Hide on root blog 477 if ( $wpdb->blogid == bp_get_root_blog_id() || !bp_is_active( 'blogs' ) ) 478 return false; 489 if ( bp_is_root_blog( $wpdb->blogid ) || ! bp_is_active( 'blogs' ) ) { 490 return false; 491 } 479 492 480 493 $blog_prefix = $wpdb->get_blog_prefix( $wpdb->blogid ); … … 490 503 foreach( (array) $authors as $author ) { 491 504 $caps = maybe_unserialize( $author->caps ); 492 if ( isset( $caps['subscriber'] ) || isset( $caps['contributor'] ) ) continue; 505 if ( isset( $caps['subscriber'] ) || isset( $caps['contributor'] ) ) { 506 continue; 507 } 493 508 494 509 echo '<li>'; … … 522 537 523 538 // Only show if viewing a user 524 if ( !bp_displayed_user_id() ) 525 return false; 539 if ( ! bp_displayed_user_id() ) { 540 return false; 541 } 526 542 527 543 // Don't show this menu to non site admins or if you're viewing your own profile 528 if ( !current_user_can( 'edit_users' ) || bp_is_my_profile() ) 529 return false; ?> 544 if ( !current_user_can( 'edit_users' ) || bp_is_my_profile() ) { 545 return false; 546 } ?> 530 547 531 548 <li id="bp-adminbar-adminoptions-menu"> … … 570 587 _e( 'Notifications', 'buddypress' ); 571 588 572 if ( $notification_count = bp_notifications_get_unread_notification_count( bp_loggedin_user_id() ) ) : ?> 589 $notification_count = bp_notifications_get_unread_notification_count( bp_loggedin_user_id() ); 590 $notifications = bp_notifications_get_notifications_for_user( bp_loggedin_user_id() ); 591 592 if ( ! empty( $notification_count ) ) : ?> 573 593 <span><?php echo bp_core_number_format( $notification_count ); ?></span> 574 594 <?php … … 578 598 echo '<ul>'; 579 599 580 if ( $notifications = bp_notifications_get_notifications_for_user( bp_loggedin_user_id()) ) {600 if ( ! empty( $notifications ) ) { 581 601 $counter = 0; 582 602 for ( $i = 0, $count = count( $notifications ); $i < $count; ++$i ) {
Note: See TracChangeset
for help on using the changeset viewer.