Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function bp_nouveau_get_group_potential_invites( $args = array() ) {
- $r = bp_parse_args( $args, array(
- 'group_id' => bp_get_current_group_id(),
- 'type' => 'alphabetical',
- 'per_page' => 20,
- 'page' => 1,
- 'search_terms' => false,
- 'member_type' => false,
- 'user_id' => 0,
- 'is_confirmed' => true,
- ) );
- if ( empty( $r['group_id'] ) ) {
- return false;
- }
- /*
- * If it's not a friend request and users can restrict invites to friends,
- * make sure they are not displayed in results.
- */
- if ( ! $r['user_id'] && bp_is_active( 'friends' ) && bp_is_active( 'settings' ) && ! bp_nouveau_groups_disallow_all_members_invites() ) {
- $r['meta_query'] = array(
- array(
- 'key' => '_bp_nouveau_restrict_invites_to_friends',
- 'compare' => 'NOT EXISTS',
- )
- );
- }
- $query = new BP_Nouveau_Group_Invite_Query( $r );
- $response = new stdClass();
- $response->meta = array( 'total_page' => 0, 'current_page' => 0 );
- $response->users = array();
- if ( ! empty( $query->results ) ) {
- $response->users = $query->results;
- if ( ! empty( $r['per_page'] ) ) {
- $response->meta = array(
- 'total_page' => ceil( (int) $query->total_users / (int) $r['per_page'] ),
- 'page' => (int) $r['page'],
- );
- }
- }
- return $response;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement