Skip to:
Content

BuddyPress.org

Changeset 11650


Ignore:
Timestamp:
07/26/2017 07:03:03 PM (9 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 (2.8-branch).

File:
1 edited

Legend:

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

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