[buddypress-trac] [BuddyPress] #4971: Infinite redirects on activity permalink when user_id = 0

buddypress-trac noreply at wordpress.org
Wed May 1 13:42:49 UTC 2013

#4971: Infinite redirects on activity permalink when user_id = 0
 Reporter:  boonebgorges  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  low           |  Milestone:  1.8
Component:  Activity      |    Version:
 Severity:  minor         |   Keywords:
 `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


 which is a relative URL, and thus takes you to



 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`.)

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4971>
BuddyPress <http://buddypress.org/>

More information about the buddypress-trac mailing list