Changeset 12435
- Timestamp:
- 08/12/2019 08:44:30 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-templates/bp-nouveau/includes/groups/classes.php
r12107 r12435 51 51 $group_member_ids = $this->get_group_member_ids(); 52 52 53 // We want to get users that are already members of the group 53 /** 54 * We want to exclude users who are already members or who have been 55 * invited by **any** of the group members to join it. 56 */ 54 57 $type = 'exclude'; 55 58 56 // We want to get invited users who did not confirmed yet59 // We want to get the invited users who did not confirmed yet. 57 60 if ( false === $this->query_vars['is_confirmed'] ) { 58 61 $type = 'include'; … … 78 81 } 79 82 83 // Fetch **all** invited users. 84 $pending_invites = groups_get_invites( array( 85 'item_id' => $this->query_vars['group_id'], 86 'invite_sent' => 'sent', 87 'fields' => 'user_ids' 88 ) ); 89 90 // This is a clue that we only want the invitations. 91 if ( false === $this->query_vars['is_confirmed'] ) { 92 return $pending_invites; 93 } 94 95 /** 96 * Otherwise, we want group members _and_ users with outstanding invitations, 97 * because we're doing an "exclude" query. 98 */ 80 99 $bp = buddypress(); 81 100 $sql = array( … … 92 111 $sql['where'][] = $wpdb->prepare( 'group_id = %d', $this->query_vars['group_id'] ); 93 112 94 if ( false === $this->query_vars['is_confirmed'] ) {95 $sql['where'][] = $wpdb->prepare( 'is_confirmed = %d', (int) $this->query_vars['is_confirmed'] );96 $sql['where'][] = 'inviter_id != 0';97 }98 99 113 // Join the query part 100 114 $sql['where'] = ! empty( $sql['where'] ) ? 'WHERE ' . implode( ' AND ', $sql['where'] ) : ''; … … 107 121 $this->group_member_ids = $wpdb->get_col( "{$sql['select']} {$sql['where']} {$sql['orderby']} {$sql['order']} {$sql['limit']}" ); 108 122 109 return $this->group_member_ids;123 return array_merge( $this->group_member_ids, $pending_invites ); 110 124 } 111 125 … … 138 152 } 139 153 140 $bp = buddypress(); 141 142 return $wpdb->get_col( $wpdb->prepare( "SELECT inviter_id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d", $user_id, $group_id ) ); 154 return groups_get_invites( array( 155 'user_id' => $user_id, 156 'item_id' => $group_id, 157 'invite_sent' => 'sent', 158 'fields' => 'inviter_ids' 159 ) ); 143 160 } 144 161 }
Note: See TracChangeset
for help on using the changeset viewer.