dozent_enrol_course( null $course = null, null $user = null, int $order_id = null, string $expired_at = '' )

Enrol an user to a specific course by given course_id | Course Object


Description

Example usage:

$enrol = dozent_enrol_course( $course, $user );

See also


Parameters

$course

(null) (Optional)

Default value: null

$user

(null) (Optional)

Default value: null

$order_id

(int) (Optional)

Default value: null

$expired_at

(string) (Optional) Date time mysql format

Default value: ''


Return

(mixed|void)


Source

File: includes/course-functions.php

	function dozent_enrol_course( $course = null, $user = null, $order_id = null, $expired_at = '' ) {

		$course = dozent_get_course( $course );
		$user   = dozent_user_data( $user );

		do_action( 'dozent_enrol_before', $course, $user );

		$enrol = $user->enrol_course( $course, $order_id, $expired_at );

		do_action( 'dozent_enrol_after', $enrol );

		/**
		 * Filter enrolment status which return by the dozent_enrol_course(); function
		 *
		 * @since DozentLMS 1.0.0
		 *
		 * @param  bool|object  $enrol  enrolment data on success, false on fail
		 * @param  object  $course  course object
		 * @param  object  $user  user data as object
		 *
		 */

		return apply_filters( 'dozent_enrol_course', $enrol, $course, $user );
	}


Changelog

Changelog
Version Description
DozentLMS 1.0.0 Introduced.