bp_core_user_get_specific_users_paged_sql

Filter the SQL string used for querying specific user paged results.

Description

apply_filters( 'bp_core_user_get_specific_users_paged_sql', (string) $paged_users_sql, (array) $user_ids, (int|null) $limit, (int) $page, (bool) $populate_extras ); 

Use this instead of the deprecated bp_core_get_specific_users_count_sql..

Parameters (5)

0. $paged_users_sql (string)
The paged users sql.
1. $user_ids (array)
Array of IDs of specific users to fetch.
2. $limit (int|null)
Max number of records to return. Null for no limit.
3. $page (int)
The page we're on for pagination.
4. $populate_extras (bool)
Whether to populate extra user fields.

Usage

To run the hook, copy the example below.
  1. $paged_users_sql = apply_filters( 'bp_core_user_get_specific_users_paged_sql', $paged_users_sql, $user_ids, $limit, $page, $populate_extras ); 
  2.  
  3. if ( !empty( $paged_users_sql ) ) { 
  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_user_get_specific_users_paged_sql callback 
  2. function filter_bp_core_user_get_specific_users_paged_sql( $paged_users_sql, $user_ids, $limit, $page, $populate_extras ) { 
  3. // make filter magic happen here... 
  4. return $paged_users_sql
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'bp_core_user_get_specific_users_paged_sql', 'filter_bp_core_user_get_specific_users_paged_sql', 10, 5 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'bp_core_user_get_specific_users_paged_sql', 'filter_bp_core_user_get_specific_users_paged_sql', 10, 5 ); 

Defined (1)

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

/bp-core/classes/class-bp-core-user.php  
  1. $paged_users_sql = apply_filters( 'bp_core_user_get_specific_users_paged_sql', $paged_users_sql, $user_ids, $limit, $page, $populate_extras );