TUTORLMS_QUIZATTEMPTED::attempted( $attempt_id )

Validates Quiz Attempt.


Parameters Parameters

$attempt_id

(Required) Post ID of the attempt


Source Source

File: src/integrations/tutorlms/triggers/tutorlms-quizattempted.php

	public function attempted( $attempt_id ) {
		// get the quiz attempt.
		$attempt = tutor_utils()->get_attempt( $attempt_id );
		// Bail if this not the registered quiz post type
		if ( 'tutor_quiz' !== get_post_type( $attempt->quiz_id ) ) {
			return;
		}
		// current user.
		$user_id = get_current_user_id();
		// trigger entry args.
		$args = [
			'code'    => $this->trigger_code,
			'meta'    => $this->trigger_meta,
			'post_id' => $attempt->quiz_id,
			'user_id' => $user_id,
		];

		// run trigger.
		Automator()->maybe_add_trigger_entry( $args, true );
	}

Top ↑

Changelog Changelog

Changelog
VersionDescription
2.4.0Introduced.