Group::getUnassociatedGroups( $include = null )

Get groups that’s not associated to ld

Description

Source

File: bp-integrations/learndash/buddypress/Group.php

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
public function getUnassociatedGroups($include = null)
{
    $meta_query = [
        'relation' => 'OR',
        [
            'key'   => '_sync_group_id',
            'value' => [ 0, '' ],
        ],
        [
            'key'     => '_sync_group_id',
            'compare' => 'NOT EXISTS',
        ],
    ];
 
    if ( $include ) {
        $meta_query[] = [
            'key'   => '_sync_group_id',
            'value' => is_array( $include ) ? $include : [ $include ]
        ];
    }
 
    return groups_get_groups( [
        'orderby'    => 'name',
        'order'      => 'asc',
        'meta_query' => [ $meta_query ],
        'per_page'   => - 1
    ] )['groups'];
}

Changelog

Changelog
Version Description
BuddyBoss 1.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.