Group::getUnassociatedGroups( $include = null )

Get groups that’s not associated to bp

Description

Source

File: bp-integrations/learndash/learndash/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 (new WP_Query([
			'post_type'      => 'groups',
			'posts_per_page' => -1,
			'orderby'        => 'name',
			'order'          => 'asc',
			'meta_query'     => [$meta_query],
		]))->posts;
	}

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.