LLMS_Membership::get_auto_enroll_courses()
Get an array of the auto enrollment course ids
Description Description
Uses a custom function due to the default "get_array" returning an array with an empty string
Return Return
(array)
Source Source
File: includes/models/model.llms.membership.php
public function get_auto_enroll_courses() { // Ensure an array when metadata is not set. $courses = isset( $this->auto_enroll ) ? $this->get( 'auto_enroll' ) : array(); // Exclude unpublished courses. $courses = array_values( array_filter( $courses, function( $id ) { return 'publish' === get_post_status( $id ); } ) ); /** * Filters the list of the membership's auto enroll courses * * @since 3.0.0 * * @param int[] $courses List of LLMS_Course IDs. * @param LLMS_Membership $membership Membership post object. */ return apply_filters( 'llms_membership_get_auto_enroll_courses', $courses, $this ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
4.15.0 | Exclude unpublished courses from the return array. |
3.0.0 | Introduced. |