Skip to:
Content

BuddyPress.org

Changes between Initial Version and Version 1 of Ticket #4062, comment 4


Ignore:
Timestamp:
11/28/2016 09:17:47 PM (8 years ago)
Author:
DJPaul
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #4062, comment 4

    initial v1  
    1 As far as I can tell the dropdown always have the correct filter selected as long as the filter that's selected (via the cookie bp-activity-filter) also has a context that exists in the current scope, i.e. if the bp-activity-filter cookie has a value of new_member and you're viewing a profile, "everything" is shown in the dropdown because the context of new_member is != member and therefore it's not shown in the dropdown generated by bp_activity_show_filters() (see: https://buddypress.trac.wordpress.org/browser/trunk/src/bp-activity/bp-activity-template.php#L3830). The problem is that the activity is still filtered by new_member in https://buddypress.trac.wordpress.org/browser/trunk/src/bp-templates/bp-legacy/buddypress-functions.php#L689 even though no activities of that type exists in the context of viewing a profile page. I've whipped up a quick patch as a proof of concept for how this could be fixed, not sure though if it's attacking the problem in the right place. This patch might need some cleanup, for example it might be better to abstract out the $context setting functionality into its own function bp_get_activity_context( $context ) or something since it's just copypasted from https://buddypress.trac.wordpress.org/browser/trunk/src/bp-activity/bp-activity-template.php#L3803 But other than that, as far as I can tell this solves the problem by not filtering activities if the $context of the filter is not a part of the current scope.
     1As far as I can tell the dropdown always have the correct filter selected as long as the filter that's selected (via the cookie bp-activity-filter) also has a context that exists in the current scope, i.e. if the bp-activity-filter cookie has a value of new_member and you're viewing a profile, "everything" is shown in the dropdown because the context of new_member is != member and therefore it's not shown in the dropdown generated by bp_activity_show_filters() (see: https://buddypress.trac.wordpress.org/browser/trunk/src/bp-activity/bp-activity-template.php#L3830).
     2
     3The problem is that the activity is still filtered by new_member in https://buddypress.trac.wordpress.org/browser/trunk/src/bp-templates/bp-legacy/buddypress-functions.php#L689 even though no activities of that type exists in the context of viewing a profile page.
     4
     5I've whipped up a quick patch as a proof of concept for how this could be fixed, not sure though if it's attacking the problem in the right place. This patch might need some cleanup, for example it might be better to abstract out the $context setting functionality into its own function bp_get_activity_context( $context ) or something since it's just copypasted from https://buddypress.trac.wordpress.org/browser/trunk/src/bp-activity/bp-activity-template.php#L3803
     6
     7But other than that, as far as I can tell this solves the problem by not filtering activities if the $context of the filter is not a part of the current scope.