Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/13/2021 03:16:36 PM (3 years ago)
Author:
imath
Message:

Add a new param to bp_activity_get() to only get the number of items

Using the count_total_only parameter with bp_activity_get() will only run the query to count the number of activity items. Using this new parameter into the Activity WP Admin Screen improves the performance of the query to get the total number of activities.

Props oztaser

Fixes #8591

File:
1 edited

Legend:

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

    r12659 r13146  
    157157            'show_hidden'      => true,
    158158            'spam'             => 'spam_only',
    159             'count_total'      => 'count_query',
     159            'count_total_only' => true,
    160160        ) );
    161161        $this->spam_count = $spams['total'];
     
    215215            $count_activities = bp_activity_get(
    216216                array(
    217                     'fields'      => 'ids',
    218                     'show_hidden' => true,
    219                     'count_total' => 'count_query',
     217                    'fields'           => 'ids',
     218                    'show_hidden'      => true,
     219                    'count_total_only' => true,
    220220                )
    221221            );
Note: See TracChangeset for help on using the changeset viewer.