Skip to:
Content

BuddyPress.org

Changeset 7660


Ignore:
Timestamp:
12/09/2013 02:34:02 PM (11 years ago)
Author:
boonebgorges
Message:

Calculate fallback value for BP_User_Query::total_users

BP_User_Query normally calculates the total_users count with a separate COUNT
query; see BP_User_Query::do_user_ids_query(). However, this method is not
called when a $user_ids parameter is passed to BP_User_Query. This changeset
introduces an alternative method for calculating total_users in this case,
ensuring that pagination works as expected.

Fixes #5271

Props imath

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-classes.php

    r7638 r7660  
    461461        ), $this ) );
    462462
     463        // We calculate total_users using a standalone query, except
     464        // when a whitelist of user_ids is passed to the constructor.
     465        // This clause covers the latter situation, and ensures that
     466        // pagination works when querying by $user_ids.
     467        if ( empty( $this->total_users ) ) {
     468            $this->total_users = count( $wp_user_query->results );
     469        }
     470
    463471        // Reindex for easier matching
    464472        $r = array();
Note: See TracChangeset for help on using the changeset viewer.