LLMS_Membership::query_associated_courses()

Retrieve courses associated with the membership


Description Description

See also See also


Top ↑

Return Return

(int[])


Top ↑

Source Source

File: includes/models/model.llms.membership.php

	protected function query_associated_courses() {

		// Start with autoenroll courses.
		$courses = $this->get_auto_enroll_courses();

		// Retrieve all access plans with a members-only availability restriction for this membership.
		foreach ( $this->query_associated_posts( 'llms_access_plan', '_llms_availability', 'members', '_llms_availability_restrictions' ) as $plan_id ) {
			$plan = llms_get_post( $plan_id );
			if ( $plan ) {
				$id = $plan->get( 'product_id' );
				if ( 'publish' === get_post_status( $id ) ) {
					$courses[] = $id;
				}
			}
		}

		return array_unique( $courses );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
4.15.0 Exclude unpublished courses.
3.38.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.