Skip to:
Content

BuddyPress.org

Ticket #1699: add_missing_get_users_qry_filter2.diff

File add_missing_get_users_qry_filter2.diff, 1.2 KB (added by MrMaz, 15 years ago)
  • bp-core-classes.php

     
    180180                        $sql['pagination'] = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
    181181
    182182                /* Get paginated results */
    183                 $paged_users = $wpdb->get_results( join( ' ', (array)$sql ) );
     183                $paged_users_sql = apply_filters( 'bp_core_get_users_sql', join( ' ', (array)$sql ), $type, $limit, $page, $user_id, $search_terms );
     184                $paged_users = $wpdb->get_results( $paged_users_sql );
    184185
    185186                /* Re-jig the SQL so we can get the total user count */
    186187                unset( $sql['select_main'] );
     
    200201                array_unshift( $sql, "SELECT COUNT(DISTINCT u.ID)" );
    201202
    202203                /* Get total user results */
    203                 $total_users = $wpdb->get_var( join( ' ', (array)$sql ) );
     204                $total_users_sql = apply_filters( 'bp_core_get_users_count_sql', join( ' ', (array)$sql ), $type, $user_id, $search_terms );
     205                $total_users = $wpdb->get_var( $total_users_sql );
    204206
    205207                /***
    206208                 * Lets fetch some other useful data in a separate queries, this will be faster than querying the data for every user in a list.