LLMS_Shortcode_Courses::get_post__in()

Retrieve an array of post ids based on submitted ID parameter and the mine parameter


Description Description


Return Return

(array)


Top ↑

Source Source

File: includes/shortcodes/class.llms.shortcode.courses.php

	protected function get_post__in() {

		$ids = array();
		$post_id = $this->get_attribute( 'id' );
		if ( $post_id ) {
			$ids = explode( ',', $post_id ); // allow multiple ids to be passed
			$ids = array_map( 'trim', $ids );
		}

		$student = llms_get_student();

		$mine = $this->get_attribute( 'mine' );
		if ( in_array( $mine, array( 'any', 'cancelled', 'enrolled', 'expired' ) ) ) {

			$courses = $student->get_courses( array(
				'limit' => 1000,
				'status' => $this->get_attribute( 'mine' ),
			) );

			$ids = $ids ? array_intersect( $ids, $courses['results'] ) : $courses['results'];

		}

		return $ids;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.31.0 Changed access from private to protected.
3.14.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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





Permalink: