dozent_get_attached_instructors( null $course = null )

Get all instructor attached in a course


Description

Instructor will be return by this function against a course.

Example usage:

$instructors = dozent_get_attached_instructors( $course );

Parameters

$course

(null) (Optional)

Default value: null


Return

(stdClass)


Source

File: includes/user-functions.php

	function dozent_get_attached_instructors( $course = null ) {
		global $wpdb;

		$course = get_post( $course );

		$results = $wpdb->get_results( " SELECT attached.ID as attached_id,
		attached.course_id,
		attached.instructor_id,
		attached.instructor_id as ID,
		attached.permissions,	 
		instructors.display_name, 
		dozent_job_title.meta_value as dozent_profile_job_title, 
		dozent_bio.meta_value as dozent_profile_bio,
		dozent_photo.meta_value as dozent_profile_photo
		
		FROM {$wpdb->dozent_instructor_courses} attached		
					
		INNER JOIN {$wpdb->users} instructors ON attached.instructor_id = instructors.ID
		LEFT JOIN {$wpdb->usermeta} dozent_job_title ON attached.instructor_id = dozent_job_title.user_id AND dozent_job_title.meta_key = '_dozent_profile_job_title'
		LEFT JOIN {$wpdb->usermeta} dozent_bio ON attached.instructor_id = dozent_bio.user_id AND dozent_bio.meta_key = '_dozent_profile_bio'
		LEFT JOIN {$wpdb->usermeta} dozent_photo ON attached.instructor_id = dozent_photo.user_id AND dozent_photo.meta_key = '_dozent_profile_photo'
	 
		WHERE course_id = {$course->ID} " );

		$std          = new stdClass();
		$std->count   = (int) dozent_count( $results );
		$std->results = $results;

		return $std;
	}


Changelog

Changelog
Version Description
DozentLMS 1.0.0 Introduced.