Ticket #4794: 4794.02.patch
File 4794.02.patch, 3.3 KB (added by , 12 years ago) |
---|
-
bp-core/bp-core-buddybar.php
function bp_core_new_nav_item( $args = '' ) { 81 81 if ( !empty( $default_subnav_slug ) && bp_is_current_action( $default_subnav_slug ) && !bp_action_variable( 0 ) ) { 82 82 unset( $bp->canonical_stack['action'] ); 83 83 } elseif ( ! bp_current_action() ) { 84 $func = is_object( $screen_function[0] ) ? array( &$screen_function[0], $screen_function[1] ) : $screen_function; 85 add_action( 'bp_screens', $func, 3 ); 84 85 // Add our screen hook if screen function is callable 86 if ( is_callable( $screen_function ) ) { 87 add_action( 'bp_screens', $screen_function, 3 ); 88 } 86 89 87 90 if ( !empty( $default_subnav_slug ) ) { 88 91 $bp->current_action = apply_filters( 'bp_default_component_subnav', $default_subnav_slug, $r ); … … function bp_core_new_nav_default( $args = '' ) { 112 115 extract( $r, EXTR_SKIP ); 113 116 114 117 if ( $function = $bp->bp_nav[$parent_slug]['screen_function'] ) { 115 if ( is_object( $function[0] ) ) { 116 remove_action( 'bp_screens', array( &$function[0], $function[1] ), 3 ); 117 } else { 118 // Remove our screen hook if screen function is callable 119 if ( is_callable( $function ) ) { 118 120 remove_action( 'bp_screens', $function, 3 ); 119 121 } 120 122 } … … function bp_core_new_nav_default( $args = '' ) { 136 138 // No subnav item has been requested in the URL, so set a new nav default 137 139 if ( empty( $unfiltered_action ) ) { 138 140 if ( !bp_is_current_action( $subnav_slug ) ) { 139 if ( is_object( $screen_function[0] ) ) { 140 add_action( 'bp_screens', array( &$screen_function[0], $screen_function[1] ), 3 ); 141 } else { 141 if ( is_callable( $screen_function ) ) { 142 142 add_action( 'bp_screens', $screen_function, 3 ); 143 143 } 144 144 … … function bp_core_new_subnav_item( $args = '' ) { 278 278 279 279 // Before hooking the screen function, check user access 280 280 if ( !empty( $user_has_access ) ) { 281 if ( is_object( $screen_function[0] ) ) { 282 add_action( 'bp_screens', array( &$screen_function[0], $screen_function[1] ), 3 ); 283 } else { 281 // Add our screen hook if screen function is callable 282 if ( is_callable( $screen_function ) ) { 284 283 add_action( 'bp_screens', $screen_function, 3 ); 285 284 } 286 285 } else { … … function bp_core_remove_nav_item( $parent_id ) { 390 389 return false; 391 390 392 391 if ( $function = $bp->bp_nav[$parent_id]['screen_function'] ) { 393 if ( is_object( $function[0] ) ) { 394 remove_action( 'bp_screens', array( &$function[0], $function[1] ), 3 ); 395 } else { 392 // Remove our screen hook if screen function is callable 393 if ( is_callable( $function ) ) { 396 394 remove_action( 'bp_screens', $function, 3 ); 397 395 } 398 396 } … … function bp_core_remove_subnav_item( $parent_id, $slug ) { 412 410 413 411 $screen_function = isset( $bp->bp_options_nav[$parent_id][$slug]['screen_function'] ) ? $bp->bp_options_nav[$parent_id][$slug]['screen_function'] : false; 414 412 415 if ( !empty( $screen_function ) ) { 416 if ( is_object( $screen_function[0] ) ) { 417 remove_action( 'bp_screens', array( &$screen_function[0], $screen_function[1] ), 3 ); 418 } else { 413 if ( ! empty( $screen_function ) ) { 414 // Remove our screen hook if screen function is callable 415 if ( is_callable( $screen_function ) ) { 419 416 remove_action( 'bp_screens', $screen_function, 3 ); 420 417 } 421 418 }