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

Determine if an instructor is a specific course author | Owner


Description

Example usage:

$is_author = dozent_is_course_author( $course ); //User will be currently logged in user
$is_author = dozent_is_course_author( $course, $user ); //User ID | Object

See also


Parameters

$course

(null) (Optional)

Default value: null

$user

(null) (Optional)

Default value: null


Return

(bool)


Source

File: includes/user-functions.php

	function dozent_is_course_author( $course = null, $user = null ) {
		$course = get_post( $course );
		$user   = dozent_get_the_user( $user );

		$is_author = false;

		if ( ! empty( $course->ID ) && ! empty( $user->ID ) && ( $course->post_author === $user->ID ) ) {
			$is_author = true;
		}

		/**
		 * Filter the output of dozent_is_course_author();
		 *
		 * @since DozentLMS 1.0.0
		 *
		 * @param  bool  $is_author
		 * @param  int|object  $course  Course could be ID or Object
		 * @param  int|object  $user  User could be ID or Object
		 */

		return apply_filters( 'dozent_is_course_author', $is_author, $course, $user );
	}


Changelog

Changelog
Version Description
DozentLMS 1.0.0 Introduced.