Ticket #1699: add_missing_get_users_qry_filter.diff
File add_missing_get_users_qry_filter.diff, 1.2 KB (added by , 15 years ago) |
---|
-
bp-core-classes.php
180 180 $sql['pagination'] = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 181 181 182 182 /* Get paginated results */ 183 $paged_users = $wpdb->get_results( join( ' ', (array)$sql ) ); 183 $paged_users_sql = apply_filters( 'bp_core_users_sql', join( ' ', (array)$sql ), $type, $limit, $page, $user_id, $search_terms ); 184 $paged_users = $wpdb->get_results( $paged_users_sql ); 184 185 185 186 /* Re-jig the SQL so we can get the total user count */ 186 187 unset( $sql['select_main'] ); … … 200 201 array_unshift( $sql, "SELECT COUNT(DISTINCT u.ID)" ); 201 202 202 203 /* Get total user results */ 203 $total_users = $wpdb->get_var( join( ' ', (array)$sql ) ); 204 $total_users_sql = apply_filters( 'bp_core_users_count_sql', join( ' ', (array)$sql ), $type, $user_id, $search_terms ); 205 $total_users = $wpdb->get_var( $total_users_sql ); 204 206 205 207 /*** 206 208 * Lets fetch some other useful data in a separate queries, this will be faster than querying the data for every user in a list.