Skip to:
Content

BuddyPress.org

Changeset 11651


Ignore:
Timestamp:
07/26/2017 07:03:49 PM (3 years ago)
Author:
r-a-y
Message:

bp-legacy: After r11356, fix issues with filtering multiple activity actions.

In #4062, we started to validate activity actions against a given context.
However, we did not take into account the validation of multiple activity
actions during AJAX activity filtering. This broke the "Friendships"
dropdown filter since it uses a comma-separated action value of
friendship_accepted,friendship_created.

This commit remedies this by accepting multiple activity actions and
cross-referencing it against the registered activity actions for the AJAX
activity querystring.

Props imath.

Fixes #7562 (trunk).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-legacy/buddypress-functions.php

    r11606 r11651  
    693693        if ( bp_is_active( 'activity' ) ) {
    694694            $actions = bp_activity_get_actions_for_context();
    695             foreach ( $actions as $action ) {
    696                 if ( $action['key'] === $_BP_COOKIE['bp-' . $object . '-filter'] ) {
    697                     $qs[] = 'action=' . $_BP_COOKIE['bp-' . $object . '-filter'];
    698                 }
     695
     696            // Handle multiple actions (eg. 'friendship_accepted,friendship_created')
     697            $action_filter = explode( ',', $_BP_COOKIE['bp-' . $object . '-filter'] );
     698
     699            // See if action filter matches registered actions. If so, add it to qs.
     700            if ( ! array_diff( $action_filter, wp_list_pluck( $actions, 'key' ) ) ) {
     701                $qs[] = 'action=' . join( ',', $action_filter );
    699702            }
    700703        }
Note: See TracChangeset for help on using the changeset viewer.