Skip to:
Content

BuddyPress.org

Changeset 13155


Ignore:
Timestamp:
11/20/2021 10:03:44 PM (2 years ago)
Author:
imath
Message:

Get the right user latest new_avatar activity before replacing it

In [13154] we missed setting the filter key of the array argument passed to the bp_activity_get() function.

See #8581

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/bp-members-activity.php

    r13154 r13155  
    193193    $user_id = apply_filters( 'bp_members_new_avatar_user_id', $user_id );
    194194
     195    // Get the BuddyPress main plugin instance.
     196    $bp = buddypress();
     197
    195198    // Check to make sure that a user has just one `new_avatar` activity per throttle time.
    196199    $last_new_avatar_activity = bp_activity_get(
    197200        array(
    198             'user_id'   => $user_id,
    199             'component' => buddypress()->members->id,
    200             'type'      => 'new_avatar',
    201201            'per_page'  => 1,
     202            'filter'    => array(
     203                'object'  => $bp->members->id,
     204                'user_id' => $user_id,
     205                'action'  => 'new_avatar',
     206            )
    202207        )
    203208    );
     
    230235        array(
    231236            'user_id'   => $user_id,
    232             'component' => buddypress()->members->id,
     237            'component' => $bp->members->id,
    233238            'type'      => 'new_avatar',
    234239        )
  • trunk/tests/phpunit/testcases/members/activity.php

    r13154 r13155  
    101101        $u = self::factory()->user->create();
    102102        $a = self::factory()->activity->create( array(
    103             'component' => 'members',
     103            'component' => buddypress()->members->id,
    104104            'type'      => 'new_avatar',
    105105            'user_id'   => $u,
     
    109109
    110110        $new_avatar_activities = bp_activity_get( array(
    111             'user_id'     => $u,
    112             'component'   => buddypress()->members->id,
    113             'type'        => 'new_avatar',
     111            'filter'    => array(
     112                'object'  => buddypress()->members->id,
     113                'user_id' => $u,
     114                'action'  => 'new_avatar',
     115            ),
    114116            'count_total' => 'count_query',
    115117        ) );
     
    129131
    130132        $a = self::factory()->activity->create( array(
    131             'component'     => 'members',
     133            'component'     => buddypress()->members->id,
    132134            'type'          => 'new_avatar',
    133135            'user_id'       => $u,
     
    138140
    139141        $new_avatar_activities = bp_activity_get( array(
    140             'user_id'     => $u,
    141             'component'   => buddypress()->members->id,
    142             'type'        => 'new_avatar',
     142            'filter'    => array(
     143                'object'  => buddypress()->members->id,
     144                'user_id' => $u,
     145                'action'  => 'new_avatar',
     146            ),
    143147            'count_total' => 'count_query',
    144148        ) );
Note: See TracChangeset for help on using the changeset viewer.