- Timestamp:
- 05/03/2023 06:18:23 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-members/classes/class-bp-members-component.php
r13464 r13468 389 389 if ( bp_displayed_user_id() ) { 390 390 $bp->canonical_stack['base_url'] = bp_displayed_user_url(); 391 392 if ( bp_current_component() ) { 393 $bp->canonical_stack['component'] = bp_current_component(); 394 } 395 396 if ( bp_current_action() ) { 397 $bp->canonical_stack['action'] = bp_current_action(); 398 } 399 400 if ( ! empty( $bp->action_variables ) ) { 401 $bp->canonical_stack['action_variables'] = bp_action_variables(); 402 } 403 404 // Looking at the single member root/home, so assume the default. 405 if ( ! bp_current_component() ) { 391 $action_variables = (array) bp_action_variables(); 392 $path_chunks = bp_members_get_path_chunks( 393 array_merge( 394 array( bp_current_component(), bp_current_action() ), 395 array_filter( $action_variables ) 396 ) 397 ); 398 399 if ( isset( $path_chunks['single_item_component'] ) ) { 400 $bp->canonical_stack['component'] = $path_chunks['single_item_component']; 401 402 // The canonical URL will not contain the default component. 403 if ( bp_is_current_component( $bp->default_component ) && ! bp_current_action() ) { 404 unset( $bp->canonical_stack['component'] ); 405 } elseif ( isset( $path_chunks['single_item_action'] ) ) { 406 $bp->canonical_stack['action'] = $path_chunks['single_item_action']; 407 408 if ( isset( $path_chunks['single_item_action_variables'] ) ) { 409 $bp->canonical_stack['action_variables'] = $path_chunks['single_item_action_variables']; 410 } 411 } 412 413 // Looking at the single member root/home, so assume the default. 414 } else { 406 415 $bp->current_component = $bp->default_component; 407 408 // The canonical URL will not contain the default component. 409 } elseif ( bp_is_current_component( $bp->default_component ) && ! bp_current_action() ) { 410 unset( $bp->canonical_stack['component'] ); 411 } 412 413 // If we're on a spammer's profile page, only users with the 'bp_moderate' cap 414 // can view subpages on the spammer's profile. 415 // 416 // users without the cap trying to access a spammer's subnav page will get 417 // redirected to the root of the spammer's profile page. this occurs by 418 // by removing the component in the canonical stack. 416 } 417 418 /* 419 * If we're on a spammer's profile page, only users with the 'bp_moderate' cap 420 * can view subpages on the spammer's profile. 421 * 422 * users without the cap trying to access a spammer's subnav page will get 423 * redirected to the root of the spammer's profile page. this occurs by 424 * by removing the component in the canonical stack. 425 */ 419 426 if ( bp_is_user_spammer( bp_displayed_user_id() ) && ! bp_current_user_can( 'bp_moderate' ) ) { 420 427 unset( $bp->canonical_stack['component'] ); … … 896 903 $action_variables = $query->get( $this->rewrite_ids['single_item_action_variables'] ); 897 904 if ( $action_variables ) { 905 $context = sprintf( 'bp_member_%1$s_%2$s_', $bp->current_component, $bp->current_action ); 906 898 907 if ( ! is_array( $action_variables ) ) { 899 $bp->action_variables = explode( '/', ltrim( $action_variables, '/' ) ); 900 } else { 901 $bp->action_variables = $action_variables; 908 $action_variables = explode( '/', ltrim( $action_variables, '/' ) ); 902 909 } 910 911 foreach ( $action_variables as $key_variable => $action_variable ) { 912 $item_component_action_variable_rewrite_id = bp_rewrites_get_custom_slug_rewrite_id( 'members', $action_variable, $context ); 913 914 if ( $item_component_action_variable_rewrite_id ) { 915 $action_variables[ $key_variable ] = str_replace( $context, '', $item_component_action_variable_rewrite_id ); 916 } 917 } 918 919 $bp->action_variables = $action_variables; 903 920 } 904 921
Note: See TracChangeset
for help on using the changeset viewer.