Skip to:
Content

BuddyPress.org

Changeset 13338


Ignore:
Timestamp:
10/06/2022 11:12:28 PM (20 months ago)
Author:
imath
Message:

BP Nouveau: improve the BP_Buttons_Group class

Make sure filtering bp_nouveau_get_activity_entry_buttons to create a
button for a specific item's loop is not propagated to other items.

As the buttons of the group are cached, we need to eventually ignore some
cache data if this filter is used to generate button for specific items of
the loop instead of all items.

Props bouncingsprout

Fixes #8716

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/includes/classes/class-bp-buttons-group.php

    r13153 r13338  
    126126     */
    127127    public function update( $args = array() ) {
     128        $button_group = array();
     129
     130        if ( is_array( $this->group ) ) {
     131            $button_group = $this->group;
     132        }
     133
     134        // If the cached button group args contains a key that is missing from args, remove it.
     135        $diff = array_diff_key( $button_group, $args );
     136        if ( $diff ) {
     137            $this->group = array_intersect_key( $button_group, $args );
     138        }
     139
    128140        foreach ( $args as $id => $params ) {
    129141            if ( isset( $this->group[ $id ] ) ) {
Note: See TracChangeset for help on using the changeset viewer.