bp_group_members_user_join_filter

Filters the SQL prepared statement used to fetch group members.

Description

Parameters (1)

0. $wpdb_prepare_select_m_user_id_m_date_modified_m_is_banned_u_user_login_u_user_nicename_u_user_email_pd_value_as_display_name_from_bp_groups_table_name_members_m_wpdb_users_u_bp_profile_table_name_data_pd_where_u_id_m_user_id_and_u_id_pd_user_id_and_pd_field_id_1_and_group_id_d_and_is_confirmed_1_banned_sql_exclude_admins_sql_exclude_sql_order_by_m_date_modified_desc_pag_sql_group_id (string)
The wpdb prepare select m user id m date modified m is banned u user login u user nicename u user email pd value as display name from bp groups table name members m wpdb users u bp profile table name data pd where u id m user id and u id pd user id and pd field id 1 and group id d and is confirmed 1 banned sql exclude admins sql exclude sql order by m date modified desc pag sql group id.

Usage

To run the hook, copy the example below.
  1. $wpdb_prepare_select_m_user_id_m_date_modified_m_is_banned_u_user_login_u_user_nicename_u_user_email_pd_value_as_display_name_from_bp_groups_table_name_members_m_wpdb_users_u_bp_profile_table_name_data_pd_where_u_id_m_user_id_and_u_id_pd_user_id_and_pd_field_id_1_and_group_id_d_and_is_confirmed_1_banned_sql_exclude_admins_sql_exclude_sql_order_by_m_date_modified_desc_pag_sql_group_id = apply_filters( 'bp_group_members_user_join_filter', $wpdb_prepare_select_m_user_id_m_date_modified_m_is_banned_u_user_login_u_user_nicename_u_user_email_pd_value_as_display_name_from_bp_groups_table_name_members_m_wpdb_users_u_bp_profile_table_name_data_pd_where_u_id_m_user_id_and_u_id_pd_user_id_and_pd_field_id_1_and_group_id_d_and_is_confirmed_1_banned_sql_exclude_admins_sql_exclude_sql_order_by_m_date_modified_desc_pag_sql_group_id ); 
  2.  
  3. if ( !empty( $wpdb_prepare_select_m_user_id_m_date_modified_m_is_banned_u_user_login_u_user_nicename_u_user_email_pd_value_as_display_name_from_bp_groups_table_name_members_m_wpdb_users_u_bp_profile_table_name_data_pd_where_u_id_m_user_id_and_u_id_pd_user_id_and_pd_field_id_1_and_group_id_d_and_is_confirmed_1_banned_sql_exclude_admins_sql_exclude_sql_order_by_m_date_modified_desc_pag_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_user_join_filter callback 
  2. function filter_bp_group_members_user_join_filter( $wpdb_prepare_select_m_user_id_m_date_modified_m_is_banned_u_user_login_u_user_nicename_u_user_email_pd_value_as_display_name_from_bp_groups_table_name_members_m_wpdb_users_u_bp_profile_table_name_data_pd_where_u_id_m_user_id_and_u_id_pd_user_id_and_pd_field_id_1_and_group_id_d_and_is_confirmed_1_banned_sql_exclude_admins_sql_exclude_sql_order_by_m_date_modified_desc_pag_sql_group_id ) { 
  3. // make filter magic happen here... 
  4. return $wpdb_prepare_select_m_user_id_m_date_modified_m_is_banned_u_user_login_u_user_nicename_u_user_email_pd_value_as_display_name_from_bp_groups_table_name_members_m_wpdb_users_u_bp_profile_table_name_data_pd_where_u_id_m_user_id_and_u_id_pd_user_id_and_pd_field_id_1_and_group_id_d_and_is_confirmed_1_banned_sql_exclude_admins_sql_exclude_sql_order_by_m_date_modified_desc_pag_sql_group_id
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'bp_group_members_user_join_filter', 'filter_bp_group_members_user_join_filter', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'bp_group_members_user_join_filter', 'filter_bp_group_members_user_join_filter', 10, 1 ); 

Defined (2)

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

/bp-groups/classes/class-bp-groups-member.php  
  1. $members = $wpdb->get_results( apply_filters( 'bp_group_members_user_join_filter', $wpdb->prepare( "SELECT m.user_id, m.date_modified, m.is_banned, u.user_login, u.user_nicename, u.user_email, pd.value as display_name FROM {$bp->groups->table_name_members} m, {$wpdb->users} u, {$bp->profile->table_name_data} pd WHERE u.ID = m.user_id AND u.ID = pd.user_id AND pd.field_id = 1 AND group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_admins_sql} {$exclude_sql} ORDER BY m.date_modified DESC {$pag_sql}", $group_id ) ) ); 
  1. $members = $wpdb->get_results( apply_filters( 'bp_group_members_user_join_filter', $wpdb->prepare( "SELECT m.user_id, m.date_modified, m.is_banned, u.user_login, u.user_nicename, u.user_email, u.display_name FROM {$bp->groups->table_name_members} m, {$wpdb->users} u WHERE u.ID = m.user_id AND group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_admins_sql} {$exclude_sql} ORDER BY m.date_modified DESC {$pag_sql}", $group_id ) ) );