Skip to:
Content

BuddyPress.org

Changeset 5313


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

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

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-blogs/bp-blogs-loader.php

    r5301 r5313  
    110110            'position'            => 30,
    111111            'screen_function'     => 'bp_blogs_screen_my_blogs',
    112             'default_subnav_slug' => 'my-blogs',
     112            'default_subnav_slug' => 'my-sites',
    113113            'item_css_id'         => $this->id
    114114        );
     115       
     116        $parent_url = trailingslashit( bp_displayed_user_domain() . bp_get_blogs_slug() );
     117       
     118        $sub_nav[] = array(
     119            'name'            => __( 'My Sites', 'buddypress' ),
     120            'slug'            => 'my-sites',
     121            'parent_url'      => $parent_url,
     122            'parent_slug'     => $bp->blogs->slug,
     123            'screen_function' => 'bp_blogs_screen_my_blogs',
     124            'position'        => 10
     125        );
    115126
    116127        // Setup navigation
    117         parent::setup_nav( $main_nav );
     128        parent::setup_nav( $main_nav, $sub_nav );
    118129    }
    119130
  • 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
  • trunk/bp-members/bp-members-loader.php

    r5302 r5313  
    115115        }
    116116
    117         if ( !$bp->current_component && bp_displayed_user_id() )
    118             $bp->current_component = $bp->default_component;
     117        if ( !bp_current_component() && bp_displayed_user_id() ) {
     118            /**
     119             * BuddyPress will attempt to resolve to the most specific URL possible,
     120             * to avoid search-engine-unfriendly content reduplication. Filter
     121             * bp_guarantee_unique_uris (and return false) to avoid this behavior
     122             */
     123            if ( apply_filters( 'bp_guarantee_unique_uris', true ) ) {
     124                bp_core_redirect( bp_displayed_user_domain() . $bp->default_component );
     125            } else {
     126                $bp->current_component = $bp->default_component;
     127            }
     128        }
    119129    }
    120130
Note: See TracChangeset for help on using the changeset viewer.