Ticket #8471: 8471.patch
File 8471.patch, 5.3 KB (added by , 4 years ago) |
---|
-
src/bp-activity/classes/class-bp-activity-component.php
diff --git src/bp-activity/classes/class-bp-activity-component.php src/bp-activity/classes/class-bp-activity-component.php index d44879fd3..5d65f693f 100644
class BP_Activity_Component extends BP_Component { 331 331 332 332 // Menus for logged in user. 333 333 if ( is_user_logged_in() ) { 334 // Get the base item (Activty Member's primary nav item). 335 $base_item = buddypress()->members->nav->get( bp_get_activity_slug() ); 334 336 335 // Setup the logged in user variables. 336 $activity_link = trailingslashit( bp_loggedin_user_domain() . bp_get_activity_slug() ); 337 if ( isset( $base_item->link, $base_item->default_subnav_slug ) ) { 338 $activity_link = $base_item->link; 339 $default_subnav = $base_item->default_subnav_slug; 340 } else { 341 $activity_link = trailingslashit( bp_loggedin_user_domain() . bp_get_activity_slug() ); 342 $default_subnav = 'just-me'; 343 } 337 344 338 345 // Unread message count. 339 346 if ( bp_activity_do_mentions() ) { … … class BP_Activity_Component extends BP_Component { 362 369 'parent' => 'my-account-' . $this->id, 363 370 'id' => 'my-account-' . $this->id . '-personal', 364 371 'title' => _x( 'Personal', 'My Account Activity sub nav', 'buddypress' ), 365 'href' => $ activity_link,372 'href' => $default_subnav === 'just-me' ? $activity_link : trailingslashit( $activity_link . 'just-me' ), 366 373 'position' => 10 367 374 ); 368 375 … … class BP_Activity_Component extends BP_Component { 372 379 'parent' => 'my-account-' . $this->id, 373 380 'id' => 'my-account-' . $this->id . '-mentions', 374 381 'title' => $title, 375 'href' => trailingslashit( $activity_link . 'mentions' ),382 'href' => $default_subnav === 'mentions' ? $activity_link : trailingslashit( $activity_link . 'mentions' ), 376 383 'position' => 20 377 384 ); 378 385 } … … class BP_Activity_Component extends BP_Component { 383 390 'parent' => 'my-account-' . $this->id, 384 391 'id' => 'my-account-' . $this->id . '-favorites', 385 392 'title' => _x( 'Favorites', 'My Account Activity sub nav', 'buddypress' ), 386 'href' => trailingslashit( $activity_link . 'favorites' ),393 'href' => $default_subnav === 'favorites' ? $activity_link : trailingslashit( $activity_link . 'favorites' ), 387 394 'position' => 30 388 395 ); 389 396 } … … class BP_Activity_Component extends BP_Component { 394 401 'parent' => 'my-account-' . $this->id, 395 402 'id' => 'my-account-' . $this->id . '-friends', 396 403 'title' => _x( 'Friends', 'My Account Activity sub nav', 'buddypress' ), 397 'href' => trailingslashit( $activity_link . bp_get_friends_slug() ),404 'href' => $default_subnav === bp_get_friends_slug() ? $activity_link : trailingslashit( $activity_link . bp_get_friends_slug() ), 398 405 'position' => 40 399 406 ); 400 407 } … … class BP_Activity_Component extends BP_Component { 405 412 'parent' => 'my-account-' . $this->id, 406 413 'id' => 'my-account-' . $this->id . '-groups', 407 414 'title' => _x( 'Groups', 'My Account Activity sub nav', 'buddypress' ), 408 'href' => trailingslashit( $activity_link . bp_get_groups_slug() ),415 'href' => $default_subnav === bp_get_groups_slug() ? $activity_link : trailingslashit( $activity_link . bp_get_groups_slug() ), 409 416 'position' => 50 410 417 ); 411 418 } -
src/bp-core/bp-core-buddybar.php
diff --git src/bp-core/bp-core-buddybar.php src/bp-core/bp-core-buddybar.php index afbb2f287..1df6bae39 100644
function bp_core_new_nav_default( $args = '' ) { 325 325 326 326 $parent_nav = reset( $parent_nav ); 327 327 328 if ( ! empty( $parent_nav->screen_function ) ) {329 // Remove our screen hook if screen function is callable.330 if ( is_callable( $parent_nav->screen_function ) ) {331 remove_action( 'bp_screens', $parent_nav->screen_function, 3 );332 }333 }334 335 328 // Edit the screen function for the parent nav. 336 $bp->members->nav->edit_nav( array( 337 'screen_function' => &$r['screen_function'], 338 'default_subnav_slug' => $r['subnav_slug'], 339 ), $parent_nav->slug ); 329 $bp->members->nav->edit_nav( 330 array( 331 'screen_function' => &$r['screen_function'], 332 'default_subnav_slug' => $r['subnav_slug'], 333 ), 334 $parent_nav->slug 335 ); 336 337 /** 338 * Update secondary nav items: 339 * - The previous default nav item needs have its slug added to its link property. 340 * - The new default nav item needs to have its slug removed from its link property. 341 */ 342 $previous_default_subnav = $bp->members->nav->get( $parent_nav->slug . '/' . $parent_nav->default_subnav_slug ); 343 344 // Edit the link of the previous default nav item. 345 $bp->members->nav->edit_nav( 346 array( 347 'link' => trailingslashit( $previous_default_subnav->link . $previous_default_subnav->slug ), 348 ), 349 $previous_default_subnav->slug, 350 $parent_nav->slug 351 ); 352 353 $new_default_subnav = $bp->members->nav->get( $parent_nav->slug . '/' . $r['subnav_slug'] ); 354 355 // Edit the link of the new default nav item. 356 $bp->members->nav->edit_nav( 357 array( 358 'link' => rtrim( untrailingslashit( $new_default_subnav->link ), $new_default_subnav->slug ), 359 ), 360 $new_default_subnav->slug, 361 $parent_nav->slug 362 ); 340 363 341 364 if ( bp_is_current_component( $parent_nav->slug ) ) { 342 365