Skip to:
Content

BuddyPress.org

Changeset 3983


Ignore:
Timestamp:
02/01/2011 07:53:50 PM (14 years ago)
Author:
johnjamesjacoby
Message:

Use bp_current_item() in place of $bp->current_item global

Location:
trunk
Files:
3 edited

Legend:

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

    r3982 r3983  
    543543function bp_current_action() {
    544544    global $bp;
    545     return apply_filters( 'bp_current_action', $bp->current_action );
     545    $current_action = !empty( $bp->current_action ) ? $bp->current_action : false;
     546    return apply_filters( 'bp_current_action', $current_action );
    546547}
    547548
    548549function bp_current_item() {
    549550    global $bp;
    550     return apply_filters( 'bp_current_item', $bp->current_item );
     551    $current_item = !empty( $bp->current_item ) ? $bp->current_item : false;
     552    return apply_filters( 'bp_current_item', $current_item );
    551553}
    552554
    553555function bp_action_variables() {
    554556    global $bp;
    555     return apply_filters( 'bp_action_variables', $bp->action_variables );
     557    $action_variables = !empty( $bp->action_variables ) ? $bp->action_variables : false;
     558    return apply_filters( 'bp_action_variables', $action_variables );
    556559}
    557560
     
    738741
    739742function bp_is_current_item( $item = '' ) {
    740     global $bp;
    741 
    742     if ( $item == $bp->current_item )
     743    if ( !empty( $item ) && $item == bp_current_item() )
    743744        return true;
    744745
  • trunk/bp-forums/bp-forums-template.php

    r3982 r3983  
    550550            $permalink = trailingslashit( bp_get_root_domain() . '/' . $bp->groups->root_slug . '/' . $forum_template->topic->object_slug );
    551551        else if ( !empty( $bp->is_single_item ) )
    552             $permalink = trailingslashit( bp_get_root_domain() . '/' . $bp->current_component . '/' . $bp->current_item );
     552            $permalink = trailingslashit( bp_get_root_domain() . '/' . $bp->current_component . '/' . bp_current_item() );
    553553        else
    554554            $permalink = trailingslashit( bp_get_root_domain() . '/' . $bp->current_component . '/' . $bp->current_action );
     
    11011101
    11021102        if ( $bp->is_single_item )
    1103             $permalink = trailingslashit( bp_get_root_domain() . '/' . $bp->current_component . '/' . $bp->current_item );
     1103            $permalink = trailingslashit( bp_get_root_domain() . '/' . $bp->current_component . '/' . bp_current_item() );
    11041104        else
    11051105            $permalink = trailingslashit( bp_get_root_domain() . $bp->current_component . '/' . $bp->current_action );
  • trunk/bp-groups/bp-groups-screens.php

    r3982 r3983  
    680680        // Ask for a login if the user is coming here via an email notification
    681681        if ( !is_user_logged_in() )
    682             bp_core_redirect( site_url( 'wp-login.php?redirect_to=' . bp_get_root_domain() . '/' . $bp->current_component . '/' . $bp->current_item . '/admin/membership-requests/' ) );
     682            bp_core_redirect( site_url( 'wp-login.php?redirect_to=' . bp_get_root_domain() . '/' . $bp->current_component . '/' . bp_current_item() . '/admin/membership-requests/' ) );
    683683
    684684        if ( !$bp->is_item_admin || 'public' == $bp->groups->current_group->status )
     
    689689
    690690        $request_action = $bp->action_variables[1];
    691         $membership_id = $bp->action_variables[2];
     691        $membership_id  = $bp->action_variables[2];
    692692
    693693        if ( isset($request_action) && isset($membership_id) ) {
Note: See TracChangeset for help on using the changeset viewer.