Skip to:
Content

BuddyPress.org

Opened 7 years ago

Last modified 7 years ago

#7639 new defect (bug)

Reopening #4706: Infinite Redirect Loop when BP_GROUPS_DEFAULT_EXTENSION is changed on Private groups

Reported by: pareshradadiya's profile pareshradadiya Owned by:
Milestone: Awaiting Contributions Priority: normal
Severity: normal Version: 2.9.2
Component: Groups Keywords: needs-patch reporter-feedback
Cc:

Description

I have set group default extension to a Members tab for a group and there is now redirect loop when non group member try to access the private group.

While redirecting away from a private group, BuddyPress doesn't appending 'home/' to the redirect URL any longer.

Ref: https://buddypress.trac.wordpress.org/ticket/4706

Change History (4)

#1 @pareshradadiya
7 years ago

  • Keywords needs-patch added; needs-refresh removed

#2 @DJPaul
7 years ago

  • Keywords reporter-feedback added
  • Milestone changed from Awaiting Review to Under Consideration

Please provide instructions how exactly to configure the group extension like this, so we can test it.

#3 @pareshradadiya
7 years ago

To reproduce, please do the following

  1. Add this constant define( 'BP_GROUPS_DEFAULT_EXTENSION', 'members' ); in wp-config.php
  2. Login as Subscriber user
  3. Navigate to Groups directory
  4. Browse private in which current logged in user is not a member

The issue is, thats there is redirect loop.

BuddyPress try to load default extension Members and since the group is private and current logged in user is not a member of that group, user will be threw back to a group default page(home) which is Members extension in this case and this goes in loop.

Please see this screencast: http://recordit.co/pTslqSjrbp

#4 @DJPaul
7 years ago

  • Milestone changed from Under Consideration to Future Release

The redirect is being triggered on https://buddypress.trac.wordpress.org/browser/trunk/src/bp-core/bp-core-buddybar.php?annotate=blame#L676 (that branch of that conditional). $subnav_item item there is:

array(11) {
  ["slug"]=>
  string(7) "members"
  ["parent_slug"]=>
  string(2) "t3"
  ["user_has_access"]=>
  bool(false)
  ["no_access_url"]=>
  string(30) "http://bpcore.local/groups/t3/"
  ["site_admin_only"]=>
  bool(false)
  ["screen_function"]=>
  &string(27) "groups_screen_group_members"
  ["name"]=>
  string(22) "Members 1"
  ["link"]=>
  string(30) "http://bpcore.local/groups/t3/"
  ["css_id"]=>
  string(7) "members"
  ["position"]=>
  int(60)
  ["show_in_admin_bar"]=>
  bool(false)
}

...which is the navigation item set here: https://buddypress.trac.wordpress.org/browser/trunk/src/bp-groups/classes/class-bp-groups-component.php#L576 ("Only add the members subnav if it's not the home's nav.") -- that makes sense, but I'm lost trying to understand what should be happening where...

It's something to do with the user not allowed to read a Private group's "members" page, but I'm not sure where the redirect should be fixed or how.

Note: See TracTickets for help on using tickets.