Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/29/2011 08:58:28 PM (13 years ago)
Author:
boonebgorges
Message:

Refactors URL canonicalization logic, moving it into the single bp_redirect_canonical() which is loaded from bp_core_load_template() instead of redirecting during the nav setup routine. See #1741. Combines all canonicalization into a single redirect. Fixes #3771. Ensures that query strings are preserved on redirects. Fixes #3777.

File:
1 edited

Legend:

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

    r5385 r5412  
    7171
    7272        if ( !empty( $default_subnav_slug ) ) {
    73             /**
    74              * BuddyPress will attempt to resolve to the most specific URL possible,
    75              * to avoid search-engine-unfriendly content reduplication. Filter
    76              * bp_guarantee_unique_uris (and return false) to avoid this behavior
    77              */
    78             if ( apply_filters( 'bp_guarantee_unique_uris', true ) ) {
    79                 bp_core_redirect( bp_displayed_user_domain() . $slug . '/' . apply_filters( 'bp_default_component_subnav', $default_subnav_slug, $r ) );
    80             } else {
    81                  $bp->current_action = apply_filters( 'bp_default_component_subnav', $default_subnav_slug, $r );
    82             }
     73            $bp->current_action           = apply_filters( 'bp_default_component_subnav', $default_subnav_slug, $r );
     74            $bp->redirect_stack['action'] = $bp->current_action;
    8375        }
    8476
     
    9183
    9284        if ( !empty( $default_subnav_slug ) ) {
    93             /**
    94              * BuddyPress will attempt to resolve to the most specific URL possible,
    95              * to avoid search-engine-unfriendly content reduplication. Filter
    96              * bp_guarantee_unique_uris (and return false) to avoid this behavior
    97              */
    98             if ( apply_filters( 'bp_guarantee_unique_uris', true ) ) {
    99                 bp_core_redirect( bp_get_root_domain() . '/' . bp_get_root_slug( bp_current_component() ) . '/' . $slug . '/' . apply_filters( 'bp_default_component_subnav', $default_subnav_slug, $r ) );
    100             } else {
    101                 $bp->current_action = apply_filters( 'bp_default_component_subnav', $default_subnav_slug, $r );
    102             }
     85            $bp->current_action           = apply_filters( 'bp_default_component_subnav', $default_subnav_slug, $r );
     86            $bp->redirect_stack['action'] = $bp->current_action;
    10387        }
    10488    }
Note: See TracChangeset for help on using the changeset viewer.