Skip to:
Content

BuddyPress.org

Opened 12 years ago

Closed 12 years ago

#4971 closed defect (bug) (fixed)

Infinite redirects on activity permalink when user_id = 0

Reported by: boonebgorges's profile boonebgorges Owned by: boonebgorges's profile boonebgorges
Milestone: 1.8 Priority: low
Severity: minor Version:
Component: Activity Keywords:
Cc:

Description

bp_activity_action_permalink_router() redirects generic activity permalink URLs of the form example.com/activity/p/12345 to the "canonical" URL for each activity item: example.com/groups/foo/activity/12345 for group activity, and example.com/members/foo/activity/12345 for all other activity. This causes problems when activity items are not associated with a user_id, because the following line:

$redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . bp_get_activity_slug() . '/' . $activity->id . '/';

will create a URL like

activity/12345/

which is a relative URL, and thus takes you to

http://example.com/activity/12345/activity/12345/

etc.

There are no places in BP where we create activity items where user_id = 0, but there are a few plugins that do so. In the long run, it might be nice if we had generic template handling for these sorts of items. But in the short run, we should at least fail more gracefully - we should fail to generate a redirect URL at all, in which case these permalinks will go to the root domain. Not ideal, but at least it doesn't result in potentially harmful infinite redirect loops. (And if plugins want to customize the behavior, they can do so using bp_activity_permalink_redirect_url.)

Change History (1)

#1 @boonebgorges
12 years ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from new to closed

In 6980:

Redirect activity permalinks to home URL when activity user_id = 0

This prevents harmful redirect loops when plugins add activity items that are
not associated with a specific user or group, which means that BP has no
template-loading function.

Fixes #4971

Note: See TracTickets for help on using tickets.