Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/08/2011 09:37:42 PM (15 years ago)
Author:
boonebgorges
Message:

Force ambiguous item URIs to resolve to their most specific versions, to avoid content duplication. Fixes #1741

File:
1 edited

Legend:

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

    r5295 r5313  
    7070                        add_action( 'bp_screens', array( &$screen_function[0], $screen_function[1] ), 3 );
    7171
    72                 if ( !empty( $default_subnav_slug ) )
    73                         $bp->current_action = apply_filters( 'bp_default_component_subnav', $default_subnav_slug, $r );
     72                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                        }
     83                }
    7484
    7585        // Look for current item
     
    8090                        add_action( 'bp_screens', array( &$screen_function[0], $screen_function[1] ), 3 );
    8191
    82                 if ( !empty( $default_subnav_slug ) )
    83                         $bp->current_action = apply_filters( 'bp_default_component_subnav', $default_subnav_slug, $r );
     92                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                        }
     103                }
    84104        }
    85105
Note: See TracChangeset for help on using the changeset viewer.