Ticket #6475: 6475.01.patch
File 6475.01.patch, 2.6 KB (added by , 10 years ago) |
---|
-
src/bp-core/bp-core-catchuri.php
241 241 242 242 // Rejig the offset 243 243 if ( !empty( $slug ) && ( 1 < count( $slug ) ) ) { 244 array_pop( $slug ); 245 $uri_offset = count( $slug ); 244 // Only offset if not on a root profile 245 // Fixes issues with nested members page and root profiles 246 if ( false === $root_profile ) { 247 array_pop( $slug ); 248 $uri_offset = count( $slug ); 249 } 246 250 } 247 251 248 252 // Global the unfiltered offset to use in bp_core_load_template(). … … 265 269 266 270 // Are we viewing a specific user? 267 271 if ( $after_member_slug ) { 272 // If root profile, we've already queried for the user 273 if ( $root_profile instanceof WP_User ) { 274 $bp->displayed_user->id = $root_profile->ID; 275 268 276 // Switch the displayed_user based on compatibility mode 269 if ( bp_is_username_compatibility_mode() ) {277 } elseif ( bp_is_username_compatibility_mode() ) { 270 278 $bp->displayed_user->id = (int) bp_core_get_userid( urldecode( $after_member_slug ) ); 279 271 280 } else { 272 281 $bp->displayed_user->id = (int) bp_core_get_userid_from_nicename( $after_member_slug ); 273 282 } 274 283 } 275 284 285 // Bump the offset. 286 if ( bp_displayed_user_id() ) { 287 if ( isset( $bp_uri[$uri_offset + 2] ) ) { 288 $bp_uri = array_merge( array(), array_slice( $bp_uri, $uri_offset + 2 ) ); 289 $bp->current_component = $bp_uri[0]; 290 291 // No component, so default will be picked later 292 } else { 293 $bp_uri = array_merge( array(), array_slice( $bp_uri, $uri_offset + 2 ) ); 294 $bp->current_component = ''; 295 } 296 297 // Reset the offset 298 $uri_offset = 0; 299 } 300 301 276 302 // Is this a member type directory? 277 303 if ( ! bp_displayed_user_id() && $after_member_slug === apply_filters( 'bp_members_member_type_base', _x( 'type', 'member type URL base', 'buddypress' ) ) && ! empty( $bp_uri[ $uri_offset + 2 ] ) ) { 278 304 $matched_types = bp_get_member_types( array( … … 304 330 } 305 331 } 306 332 307 // Bump the offset.308 if ( bp_displayed_user_id() ) {309 if ( isset( $bp_uri[$uri_offset + 2] ) ) {310 $bp_uri = array_merge( array(), array_slice( $bp_uri, $uri_offset + 2 ) );311 $bp->current_component = $bp_uri[0];312 313 // No component, so default will be picked later314 } else {315 $bp_uri = array_merge( array(), array_slice( $bp_uri, $uri_offset + 2 ) );316 $bp->current_component = '';317 }318 }319 320 // Reset the offset321 $uri_offset = 0;322 333 } 323 334 } 324 335