WPLMS_QUIZCOMPLETED::wplms_quiz_completed( integer $quiz_id, string $marks, integer $user_id )

Validation function when the trigger action is hit


Parameters Parameters

$quiz_id

(integer) (Required)

$marks

(string) (Required) Can be a single number of a range separated by "-"

$user_id

(integer) (Required)


Source Source

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

	public function wplms_quiz_completed( $quiz_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( $quiz_id ),
			'user_id' => $user_id,
		];

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