LLMS_REST_Enrollments_Controller::enrollment_exists( int $student_id, int $post_id, string $trigger = 'any', boolean $wp_error = true )

Check enrollment existence.


Parameters Parameters

$student_id

(int) (Required) Student ID.

$post_id

(int) (Required) The course/membership ID.

$trigger

(string) (Optional) The enrollment trigger. Default 'any'.

Default value: 'any'

$wp_error

(boolean) (Optional) Whether return a WP_Error instance or a boolean. Default true (returns WP_Error).

Default value: true


Top ↑

Return Return

(WP_Error|boolean)


Top ↑

Source Source

File: libraries/lifterlms-rest/includes/server/class-llms-rest-enrollments-controller.php

		return rest_ensure_response( $response );

	}

	/**
	 * Check enrollment existence.
	 *
	 * @since 1.0.0-beta.1
	 * @since 1.0.0-beta.10 Added the `trigger` param.
	 * @since 1.0.0-beta.26 By default don't load the current user if a falsy student ID is supplied.
	 *
	 * @param int     $student_id Student ID.
	 * @param int     $post_id    The course/membership ID.
	 * @param string  $trigger    Optional. The enrollment trigger. Default 'any'.
	 * @param boolean $wp_error   Optional. Whether return a WP_Error instance or a boolean. Default true (returns WP_Error).
	 * @return WP_Error|boolean
	 */
	protected function enrollment_exists( $student_id, $post_id, $trigger = 'any', $wp_error = true ) {

		$student = llms_get_student( $student_id, false );



Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.10 Added the trigger param.
1.0.0-beta.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.