Ticket #6477: 6477.02.patch
| File 6477.02.patch, 2.2 KB (added by , 11 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. Fixes issue when Members page is nested. 245 if ( false === $root_profile ) { 246 array_pop( $slug ); 247 $uri_offset = count( $slug ); 248 } 246 249 } 247 250 248 251 // Global the unfiltered offset to use in bp_core_load_template(). … … 265 268 266 269 // Are we viewing a specific user? 267 270 if ( $after_member_slug ) { 271 // If root profile, we've already queried for the user 272 if ( $root_profile instanceof WP_User ) { 273 $bp->displayed_user->id = $root_profile->ID; 274 268 275 // Switch the displayed_user based on compatibility mode 269 if ( bp_is_username_compatibility_mode() ) {276 } elseif ( bp_is_username_compatibility_mode() ) { 270 277 $bp->displayed_user->id = (int) bp_core_get_userid( urldecode( $after_member_slug ) ); 278 271 279 } else { 272 280 $bp->displayed_user->id = (int) bp_core_get_userid_from_nicename( $after_member_slug ); 273 281 } -
tests/phpunit/testcases/routing/root-profiles.php
42 42 $this->assertEquals( $this->u->ID, bp_displayed_user_id() ); 43 43 } 44 44 45 /** 46 * @ticket BP6475 47 */ 48 public function test_member_permalink_when_members_page_is_nested_under_wp_page() { 49 $p = $this->factory->post->create( array( 50 'post_type' => 'page', 51 'post_name' => 'foo', 52 ) ); 53 54 $members_page = get_page_by_path( 'members' ); 55 wp_update_post( array( 56 'ID' => $members_page->ID, 57 'post_parent' => $p, 58 ) ); 59 60 $domain = home_url( $this->u->user_nicename ); 61 $this->go_to( $domain ); 62 63 $this->assertTrue( bp_is_user() ); 64 $this->assertTrue( bp_is_my_profile() ); 65 $this->assertEquals( $this->u->ID, bp_displayed_user_id() ); 66 } 67 45 68 public function test_member_activity_page() { 46 69 $url = home_url( $this->u->user_nicename ) . '/' . bp_get_activity_slug(); 47 70 $this->go_to( $url );
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)