Course::get_contents()

Get the course contents from DB Query


Return

(mixed|void|null)


Source

File: classes/Course.php

	public function get_contents() {
		global $wpdb;

		if ( ! $this->id ) {
			return null;
		}

		$contents = wp_cache_get( $this->id, 'dozent_course_contents' );

		if ( ! $contents ) {
			$contents = $wpdb->get_results( "SELECT items.* FROM {$wpdb->posts} sections
				INNER JOIN {$wpdb->posts} items ON sections.ID = items.post_parent 
				WHERE sections.post_parent = {$this->id} AND items.post_status = 'publish' order by sections.menu_order ASC, items.menu_order ASC;" );

			wp_cache_add( $this->id, $contents, 'dozent_course_contents' );
		}

		/**
		 * Filter the course contents
		 *
		 * @since DozentLMS 1.0.0
		 *
		 * @param  null|object  $contents  Course Contents
		 * @param  object  $this  Course
		 */

		return apply_filters( 'dozent_get_course_contents', $contents, $this );
	}


Changelog

Changelog
Version Description
DozentLMS 1.0.0 Introduced.