Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/09/2012 03:25:20 PM (13 years ago)
Author:
boonebgorges
Message:

Reconfigures canonical redirection so that URIs canonicalize up (less specific) rather than down (more specific). Fixes #1741

File:
1 edited

Legend:

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

    r5868 r5895  
    164164        }
    165165       
    166         if ( bp_is_groups_component() && !empty( $this->current_group ) && !bp_current_action() ) {
    167             $bp->current_action              = apply_filters( 'bp_groups_default_extension', defined( 'BP_GROUPS_DEFAULT_EXTENSION' ) ? BP_GROUPS_DEFAULT_EXTENSION : 'home' );
     166        if ( bp_is_groups_component() && !empty( $this->current_group ) ) {
     167                       
     168            // Prepare for a redirect to the canonical URL
     169            $bp->canonical_stack['base_url'] = bp_get_group_permalink( $this->current_group );
    168170           
    169             // Prepare for a redirect to the canonical URL
    170             $bp->redirect_stack['base_url']  = bp_get_group_permalink( $this->current_group );
    171             $bp->redirect_stack['action']    = bp_current_action();
     171            if ( bp_current_action() ) {
     172                $bp->canonical_stack['action'] = bp_current_action();
     173            }
     174           
     175            if ( !empty( $bp->action_variables ) ) {
     176                $bp->canonical_stack['action_variables'] = bp_action_variables();
     177            }
     178           
     179            $groups_default_extension = apply_filters( 'bp_groups_default_extension', defined( 'BP_GROUPS_DEFAULT_EXTENSION' ) ? BP_GROUPS_DEFAULT_EXTENSION : 'home' );
     180           
     181            if ( !bp_current_action() ) {
     182                $bp->current_action = $groups_default_extension;
     183            } else if ( bp_is_current_action( $groups_default_extension ) && !empty( $bp->action_variables ) )  {
     184                unset( $bp->canonical_stack['action'] );
     185            }
    172186        }
    173187
Note: See TracChangeset for help on using the changeset viewer.