Ticket #2593: filter_get_users_sql.patch
File filter_get_users_sql.patch, 1.1 KB (added by , 14 years ago) |
---|
-
bp-core-classes.php
188 188 189 189 if ( $limit && $page ) 190 190 $sql['pagination'] = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ); 191 192 $paged_users_sql = apply_filters( 'bp_core_get_paged_users_sql', join( ' ', (array)$sql ) ); 191 193 192 194 /* Get paginated results */ 193 $paged_users = $wpdb->get_results( join( ' ', (array)$sql ));195 $paged_users = $wpdb->get_results( $paged_users_sql ); 194 196 195 197 /* Re-jig the SQL so we can get the total user count */ 196 198 unset( $sql['select_main'] ); … … 209 211 210 212 array_unshift( $sql, "SELECT COUNT(DISTINCT u.ID)" ); 211 213 214 $total_users_sql = apply_filters( 'bp_core_get_total_users_sql', join( ' ', (array)$sql ) ); 215 212 216 /* Get total user results */ 213 $total_users = $wpdb->get_var( join( ' ', (array)$sql ));217 $total_users = $wpdb->get_var( $total_users_sql ); 214 218 215 219 /*** 216 220 * Lets fetch some other useful data in a separate queries, this will be faster than querying the data for every user in a list.