LLMS_Course::get_lesson_ids()

Get all lesson ids associated with a course


Description Description


Return Return

(array) $array [array of all lesson ids in a course]


Top ↑

Source Source

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

	public function get_lesson_ids() {
		$lessons = array();

		$args = array(
			'post_type' 		=> 'section',
			'posts_per_page'	=> 500,
			'meta_key'			=> '_llms_order',
			'order'				=> 'ASC',
			'orderby'			=> 'meta_value_num',
			'meta_query' 		=> array(
				array(
					'key' 		=> '_llms_parent_course',
	      			'value' 	=> $this->id,
	      			'compare' 	=> '=',
	  			),
		  	),
		);

		$sections = get_posts( $args );

		foreach ( $sections as $s ) {
			$section = new LLMS_Section( $s->ID );
			$lessonset = $section->get_children_lessons();
			foreach ( $lessonset as $lessonojb ) {
				$lessons[] = $lessonojb->ID;
			}
		}

		return $lessons;
	}

Top ↑

User Contributed Notes User Contributed Notes

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





Permalink: