WPLMS_COURSECOMPLETED::wplms_course_completed( integer $course_id, null $marks, integer $user_id )

Validation function when the trigger action is hit


Parameters Parameters

$course_id

(integer) (Required)

$marks

(null) (Required)

$user_id

(integer) (Required)


Source Source

File: src/integrations/wplms/triggers/wplms-coursecompleted.php

	public function wplms_course_completed( $course_id, $marks, $user_id ) {

		if ( ! $user_id ) {
			$user_id = get_current_user_id();
		}

		if ( empty( $user_id ) ) {
			return;
		}



		$args = [
			'code'    => $this->trigger_code,
			'meta'    => $this->trigger_meta,
			'post_id' => intval( $course_id ),
			'user_id' => $user_id,
		];

		Automator()->maybe_add_trigger_entry( $args );
	}