Changeset 3372
- Timestamp:
- 11/07/2010 11:25:07 AM (14 years ago)
- Location:
- trunk/bp-groups
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-classes.php
r3371 r3372 998 998 } 999 999 1000 function get_all_for_group( $group_id, $limit = false, $page = false, $exclude_admins_mods = true, $exclude_banned = true ) {1000 function get_all_for_group( $group_id, $limit = false, $page = false, $exclude_admins_mods = true, $exclude_banned = true, $exclude = false ) { 1001 1001 global $bp, $wpdb; 1002 1002 … … 1005 1005 1006 1006 if ( $exclude_admins_mods ) 1007 $exclude_ sql = $wpdb->prepare( "AND is_admin = 0 AND is_mod = 0" );1007 $exclude_admins_sql = $wpdb->prepare( "AND is_admin = 0 AND is_mod = 0" ); 1008 1008 1009 1009 if ( $exclude_banned ) 1010 1010 $banned_sql = $wpdb->prepare( " AND is_banned = 0" ); 1011 1011 1012 if ( $exclude ) 1013 $exclude_sql = $wpdb->prepare( " AND m.user_id NOT IN ({$exclude})" ); 1014 1012 1015 if ( bp_is_active( 'xprofile' ) ) 1013 $members = $wpdb->get_results( $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_ sql} ORDER BY m.date_modified DESC {$pag_sql}", $group_id ) );1016 $members = $wpdb->get_results( $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 ) ); 1014 1017 else 1015 $members = $wpdb->get_results( $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_ sql} ORDER BY m.date_modified DESC {$pag_sql}", $group_id ) );1018 $members = $wpdb->get_results( $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 ) ); 1016 1019 1017 1020 if ( !$members ) … … 1021 1024 $total_member_count = count($members); 1022 1025 else 1023 $total_member_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(user_id) FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_ sql}", $group_id ) );1026 $total_member_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(user_id) FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 1 {$banned_sql} {$exclude_admins_sql} {$exclude_sql}", $group_id ) ); 1024 1027 1025 1028 /* Fetch whether or not the user is a friend */ -
trunk/bp-groups/bp-groups-templatetags.php
r3371 r3372 1281 1281 var $total_group_count; 1282 1282 1283 function bp_groups_group_members_template( $group_id, $per_page, $max, $exclude_admins_mods, $exclude_banned ) {1283 function bp_groups_group_members_template( $group_id, $per_page, $max, $exclude_admins_mods, $exclude_banned, $exclude ) { 1284 1284 global $bp; 1285 1285 … … 1287 1287 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page; 1288 1288 1289 $this->members = BP_Groups_Member::get_all_for_group( $group_id, $this->pag_num, $this->pag_page, $exclude_admins_mods, $exclude_banned );1289 $this->members = BP_Groups_Member::get_all_for_group( $group_id, $this->pag_num, $this->pag_page, $exclude_admins_mods, $exclude_banned, $exclude ); 1290 1290 1291 1291 if ( !$max || $max >= (int)$this->members['count'] ) … … 1368 1368 'per_page' => 20, 1369 1369 'max' => false, 1370 'exclude' => false, 1370 1371 'exclude_admins_mods' => 1, 1371 1372 'exclude_banned' => 1 … … 1375 1376 extract( $r, EXTR_SKIP ); 1376 1377 1377 $members_template = new BP_Groups_Group_Members_Template( $group_id, $per_page, $max, (int)$exclude_admins_mods, (int)$exclude_banned );1378 $members_template = new BP_Groups_Group_Members_Template( $group_id, $per_page, $max, (int)$exclude_admins_mods, (int)$exclude_banned, $exclude ); 1378 1379 return apply_filters( 'bp_group_has_members', $members_template->has_members(), &$members_template ); 1379 1380 }
Note: See TracChangeset
for help on using the changeset viewer.