Changeset 4904
- Timestamp:
- 07/30/2011 11:53:25 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-buddybar.php
r4867 r4904 83 83 $bp->current_action = apply_filters( 'bp_default_component_subnav', $default_subnav_slug, $r ); 84 84 } 85 85 86 86 do_action( 'bp_core_new_nav_item', $r, $args, $defaults ); 87 87 } … … 205 205 'screen_function' => &$screen_function 206 206 ); 207 207 208 208 /** 209 209 * The last step is to hook the screen function for the added subnav item. But this only … … 222 222 * user, since groups should always have an action set. 223 223 */ 224 224 225 225 // If we *don't* meet condition (1), return 226 226 if ( $bp->current_component != $parent_slug && $bp->current_item != $parent_slug ) 227 227 return; 228 228 229 229 // If we *do* meet condition (2), then the added subnav item is currently being requested 230 230 if ( ( !empty( $bp->current_action ) && $slug == $bp->current_action ) || ( bp_is_user() && empty( $bp->current_action ) && $screen_function == $bp->bp_nav[$parent_slug]['screen_function'] ) ) { 231 231 232 232 // Before hooking the screen function, check user access 233 233 if ( $user_has_access ) { … … 240 240 // depending on whether the current user is logged in 241 241 if ( is_user_logged_in() ) { 242 // Off-limits to this user. Throw an error and redirect to the displayed user's domain 242 // Off-limits to this user. Throw an error and redirect to the displayed user's domain 243 243 bp_core_no_access( array( 244 244 'message' => __( 'You do not have access to this page.', 'buddypress' ), … … 295 295 function bp_nav_item_has_subnav( $nav_item = '' ) { 296 296 global $bp; 297 297 298 298 if ( !$nav_item ) 299 299 $nav_item = bp_current_component(); 300 300 301 301 $has_subnav = isset( $bp->bp_options_nav[$nav_item] ) && count( $bp->bp_options_nav[$nav_item] ) > 0; 302 302 303 303 return apply_filters( 'bp_nav_item_has_subnav', $has_subnav, $nav_item ); 304 304 } … … 342 342 global $bp; 343 343 344 $screen_function = $bp->bp_options_nav[$parent_id][$slug]['screen_function'];344 $screen_function = ( isset( $bp->bp_options_nav[$parent_id][$slug]['screen_function'] ) ) ? $bp->bp_options_nav[$parent_id][$slug]['screen_function'] : false; 345 345 346 346 if ( $screen_function ) { … … 353 353 unset( $bp->bp_options_nav[$parent_id][$slug] ); 354 354 355 if ( !count( $bp->bp_options_nav[$parent_id] ) )355 if ( isset( $bp->bp_options_nav[$parent_id] ) && !count( $bp->bp_options_nav[$parent_id] ) ) 356 356 unset($bp->bp_options_nav[$parent_id]); 357 357 }
Note: See TracChangeset
for help on using the changeset viewer.