dozent_has_instructor_permission_dashboard_permalink( null $permalink_id = null, int $instructor_id )

Check if an instructor has permission for dashboard permalink


Description

Example usage:

dozent_has_instructor_permission_dashboard_permalink();

See also


Parameters

$permalink_id

(null) (Optional)

Default value: null

$instructor_id

(int) (Required)


Return

(mixed|void)


Source

File: includes/core-functions.php

	function dozent_has_instructor_permission_dashboard_permalink( $permalink_id = null, $instructor_id = 0 ) {

		$has_permission = true;
		$instructor_id  = dozent_get_user_id( $instructor_id );

		if ( $permalink_id && $instructor_id ) {

			$dashboard_permalink = dozent_get_dashboard_permalink_by_id( $permalink_id );

			if ( dozent_count( $dashboard_permalink ) ) {

				$instructor_item = (bool) dozent_array_get( 'instructor_item', $dashboard_permalink );
				$permalink_group = dozent_array_get( 'group_name', $dashboard_permalink );
				if ( $permalink_group === 'group-instructor' ) {
					$instructor_item = true;
				}

				$is_instructor_approved = dozent_is_instructor_approved( $instructor_id );

				if ( $instructor_item && ! $is_instructor_approved ) {
					$has_permission = false;
				}

			}
		}

		/**
		 * Filter the permission returns by dozent_has_instructor_permission_dashboard_permalink();
		 *
		 * @since DozentLMS 1.0.0
		 */

		return apply_filters( 'dozent_has_instructor_permission_dashboard_permalink', $has_permission, $permalink_id );
	}


Changelog

Changelog
Version Description
DozentLMS 1.0.0 Introduced.