Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/13/2012 05:46:52 AM (13 years ago)
Author:
johnjamesjacoby
Message:

Clean up $bp->current_component, $bp->current_action, and $bp->current_item usage. Fixes #3738.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-buddybar.php

    r5751 r5758  
    125125    }
    126126
    127     if ( $bp->current_component == $parent_slug && !$bp->current_action ) {
    128         if ( !is_object( $screen_function[0] ) )
     127    if ( bp_is_current_component( $parent_slug ) && !bp_current_action() ) {
     128        if ( !is_object( $screen_function[0] ) ) {
    129129            add_action( 'bp_screens', $screen_function );
    130         else
     130        } else {
    131131            add_action( 'bp_screens', array( &$screen_function[0], $screen_function[1] ) );
     132        }
    132133
    133134        if ( $subnav_slug ) {
     
    237238
    238239    // If we *don't* meet condition (1), return
    239     if ( $bp->current_component != $parent_slug && $bp->current_item != $parent_slug )
     240    if ( ! bp_is_current_component( $parent_slug ) && ! bp_is_current_item( $parent_slug ) )
    240241        return;
    241242
    242243    // If we *do* meet condition (2), then the added subnav item is currently being requested
    243     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'] ) ) {
     244    if ( ( bp_current_action() && bp_is_current_action( $slug ) ) || ( bp_is_user() && ! bp_current_action() && ( $screen_function == $bp->bp_nav[$parent_slug]['screen_function'] ) ) ) {
    244245
    245246        // Before hooking the screen function, check user access
    246         if ( $user_has_access ) {
    247             if ( !is_object( $screen_function[0] ) )
     247        if ( !empty( $user_has_access ) ) {
     248            if ( !is_object( $screen_function[0] ) ) {
    248249                add_action( 'bp_screens', $screen_function );
    249             else
     250            } else {
    250251                add_action( 'bp_screens', array( &$screen_function[0], $screen_function[1] ) );
     252            }
    251253        } else {
    252254            // When the content is off-limits, we handle the situation differently
Note: See TracChangeset for help on using the changeset viewer.