bp_group_members_count_user_join_filter

Filters the SQL prepared statement used to fetch group members total count.

Description

Parameters (1)

0. $wpdb_prepare_select_count_user_id_from_bp_groups_table_name_members_m_where_group_id_d_and_is_confirmed_1_banned_sql_exclude_admins_sql_exclude_sql_group_id (number)
The wpdb prepare select count user id from bp groups table name members m where group id d and is confirmed 1 banned sql exclude admins sql exclude sql group id.

Usage

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

Defined (1)

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

/bp-groups/classes/class-bp-groups-member.php  
  1. $total_member_count = $wpdb->get_var( apply_filters( 'bp_group_members_count_user_join_filter', $wpdb->prepare( "SELECT COUNT(user_id) FROM {$bp->groups->table_name_members} m WHERE group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_admins_sql} {$exclude_sql}", $group_id ) ) );