Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/07/2015 03:56:36 PM (9 years ago)
Author:
imath
Message:

Groups Homes: make sure the action parameter of the canonical stack is reset to home in two specific cases.

When the Group does not use a custom front.php template:
(1) If the Activity component is not active, the home page displays the members of the Group.
(2) If the Activity component is active, the home page displays the activities of the Group.

In case (1), a user trying to directly access to site.url/groups/single/members must be redirected
to the home page.
In case (2), a user trying to directly access to site.url/groups/single/activity must be redirected to the home page.

Props jmarx75 (Congrats for your first ticket and patch, welcome on board!)

Fixes #6646

File:
1 edited

Legend:

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

    r10184 r10205  
    391391        }
    392392
     393        /**
     394         * If there's no custom front.php template for the group, we need to make sure the canonical stack action
     395         * is set to 'home' in these 2 cases:
     396         *
     397         * - the current action is 'activity' (eg: site.url/groups/single/activity) and the Activity component is active
     398         * - the current action is 'members' (eg: site.url/groups/single/members) and the Activity component is *not* active.
     399         */
     400        if ( ! $this->current_group->front_template && ( bp_is_current_action( 'activity' ) || ( ! bp_is_active( 'activity' ) && bp_is_current_action( 'members' ) ) ) ) {
     401            $bp->canonical_stack['action'] = 'home';
     402        }
     403
    393404        if ( ! empty( $bp->action_variables ) ) {
    394405            $bp->canonical_stack['action_variables'] = bp_action_variables();
Note: See TracChangeset for help on using the changeset viewer.