LLMS_Membership::query_associated_courses()
Retrieve courses associated with the membership
Description Description
See also See also
Return Return
(int[])
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 ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
4.15.0 | Exclude unpublished courses. |
3.38.1 | Introduced. |