Group::getUnassociatedGroups( $include = null )

Get groups that’s not associated to ld

Description

Source

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

	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.