Opened 12 years ago
Closed 12 years ago
#4706 closed defect (bug) (fixed)
Infinite Redirect Loop when BP_GROUPS_DEFAULT_EXTENSION is changed on Private groups
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 1.7 | Priority: | normal |
Severity: | minor | Version: | 1.6.1 |
Component: | Groups | Keywords: | |
Cc: |
Description
When you change the default extension of your groups to something besides home (say forums) and the group is listed as private it causes a infinite redirection loop.
See: http://buddypress.org/support/topic/changing-group-home-page-causes-infinite-loop-in-private-groups/
its an easy fix to just add the /home/ to the default path in the setup globals function of /bp-groups/bp-groups-loader.php (line: 270ish)
This is the area of code modified
if ( !$this->current_group->user_has_access ) { // Hidden groups should return a 404 for non-members. // Unset the current group so that you're not redirected // to the default group tab if ( 'hidden' == $this->current_group->status ) { $this->current_group = 0; $bp->is_single_item = false; bp_do_404(); return; // Skip the no_access check on home and membership request pages } elseif ( !bp_is_current_action( 'home' ) && !bp_is_current_action( 'request-membership' ) ) { // Off-limits to this user. Throw an error and redirect to the group's home page if ( is_user_logged_in() ) { bp_core_no_access( array( 'message' => __( 'You do not have access to this group.', 'buddypress' ), 'root' => bp_get_group_permalink( $bp->groups->current_group ) . '/home/', 'redirect' => false ) ); // User does not have access, and does not get a message } else { bp_core_no_access(); } } }
Major note for people finding this, some plugins like Group Hierarchy extend the groups component class and overwrite the setup globals function so even if this gets changed it will cause an error until they update (or you go crazy trying to figure it out like me)
Change History (2)
#1
@
12 years ago
- Component changed from Core to Groups
- Milestone changed from Awaiting Review to 1.7
- Severity changed from major to minor
#2
@
12 years ago
- Resolution set to fixed
- Status changed from new to closed
(In [6651]) When redirecting away from a private group, append 'home/' to the redirect URL
This helps to avoid a redirect loop when the default extension for groups is
set to something other than the default, because the 'home' tab of private
groups is an always-accessible landing page for the "This is a private group"
message.
Fixes #4706
Props DennisSmolek
I find this whole block of logic to be on the inelegant side, but your suggestion does seem to fix the problem because of the
! bp_is_current_action( 'home' )
check.