bp_nouveau_get_group_potential_invites( $args = array() )

Get potential group invites.

Description

Source

File: bp-templates/bp-nouveau/includes/groups/functions.php

276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
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;
}

Changelog

Changelog
Version Description
BuddyPress 3.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.