dozent_instructor_is_attached_to_course( null $course = null, null $user = null )

Check if an instructor attached with a course


Description

Weather is an user is a specific course instructor

Example usage:

$is_attached = dozent_instructor_is_attached_to_course( $course, $user );

See also


Parameters

$course

(null) (Optional)

Default value: null

$user

(null) (Optional)

Default value: null


Return

(mixed|void)


Source

File: includes/user-functions.php

	function dozent_instructor_is_attached_to_course( $course = null, $user = null ) {
		global $wpdb;

		$course = get_post( $course );
		$user   = dozent_get_the_user( $user );

		$is_attached
			= $wpdb->get_row( " SELECT * FROM {$wpdb->dozent_instructor_courses} WHERE course_id = {$course->ID} AND instructor_id = {$user->ID} " );

		if ( $is_attached ) {
			return apply_filters( 'dozent_instructor_is_attached_to_course', $is_attached, $course, $user );
		}

		return apply_filters( 'dozent_instructor_is_attached_to_course', false, $course, $user );
	}


Changelog

Changelog
Version Description
DozentLMS 1.0.0 Introduced.