Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/25/2022 07:33:13 PM (3 years ago)
Author:
imath
Message:

Improve the activity loop to be able to get items below a max. ID

The $filter parameter of this loop now includes a new $offset_lower
argument making it possible to only retrieve activities having an ID
lower than this argument provided value.

We are using this filter to avoid a possible activity duplicate when
clicking on the "Load More" link.

Closes https://github.com/buddypress/buddypress/pull/29
Fixes #4535

File:
1 edited

Legend:

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

    r13337 r13344  
    19231923     *     @type int              $offset       Return only those items with an ID greater
    19241924     *                                          than the offset value.
     1925     *     @type int              $offset_lower Return only those items with an ID lower
     1926     *                                          than the offset value.
    19251927     *     @type string           $since        Return only those items that have a
    19261928     *                                          date_recorded value greater than a
     
    19661968            $sid_sql = absint( $filter_array['offset'] );
    19671969            $filter_sql[] = "a.id >= {$sid_sql}";
     1970        }
     1971
     1972        if ( ! empty( $filter_array['offset_lower'] ) ) {
     1973            $sid_sql = absint( $filter_array['offset_lower'] );
     1974            $filter_sql[] = "a.id < {$sid_sql}";
    19681975        }
    19691976
Note: See TracChangeset for help on using the changeset viewer.