bp_core_get_specific_users_count_sql

Filter the SQL string used for querying specific user count.

Description

apply_filters( 'bp_core_get_specific_users_count_sql', (string) $select_count_id_from_wpdb_users_where_status_sql_and_id_in_user_ids ); 

This same filter name is used for the paged user SQL, and so should be avoided. Use bp_core_user_get_specific_users_count_sql instead.

Parameters (1)

0. $select_count_id_from_wpdb_users_where_status_sql_and_id_in_user_ids (string) => "SELECT COUNT(ID) FROM {$wpdb->users} WHERE {$status_sql} AND ID IN ({$user_ids})"
The select count id from wpdb users where status sql and id in user ids.

Usage

To run the hook, copy the example below.
  1. $select_count_id_from_wpdb_users_where_status_sql_and_id_in_user_ids = apply_filters( 'bp_core_get_specific_users_count_sql', $select_count_id_from_wpdb_users_where_status_sql_and_id_in_user_ids ); 
  2.  
  3. if ( !empty( $select_count_id_from_wpdb_users_where_status_sql_and_id_in_user_ids ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the bp_core_get_specific_users_count_sql callback 
  2. function filter_bp_core_get_specific_users_count_sql( $select_count_id_from_wpdb_users_where_status_sql_and_id_in_user_ids ) { 
  3. // make filter magic happen here... 
  4. return $select_count_id_from_wpdb_users_where_status_sql_and_id_in_user_ids
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'bp_core_get_specific_users_count_sql', 'filter_bp_core_get_specific_users_count_sql', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'bp_core_get_specific_users_count_sql', 'filter_bp_core_get_specific_users_count_sql', 10, 1 ); 

Defined (2)

The filter is defined in the following location(s).

/bp-core/classes/class-bp-core-user.php  
  1. $total_users_sql = apply_filters( 'bp_core_get_specific_users_count_sql', "SELECT COUNT(ID) FROM {$wpdb->users} WHERE {$status_sql} AND ID IN ({$user_ids})" ); 
  1. $paged_users_sql = apply_filters( 'bp_core_get_specific_users_count_sql', "SELECT ID as id, user_registered, user_nicename, user_login, user_email FROM {$wpdb->users} WHERE {$status_sql} AND ID IN ({$user_ids}) {$pag_sql}" );