LD_QUIZDONE::learndash_quiz_completed( $data,  $current_user )

Validation function when the trigger action is hit


Parameters Parameters

$data

(Required)


Source Source

File: src/integrations/learndash/triggers/ld-quizdone.php

	public function learndash_quiz_completed( $data, $current_user ) {
		if ( empty( $data ) ) {
			return;
		}

		$user    = $current_user;
		$quiz    = $data['quiz'];
		$post_id = is_object( $quiz ) ? $quiz->ID : $quiz;
		if ( empty( $user ) ) {
			$user = wp_get_current_user();
		}
		$args = [
			'code'    => $this->trigger_code,
			'meta'    => $this->trigger_meta,
			'post_id' => (int) $post_id,
			'user_id' => $user->ID,
		];
		Automator()->maybe_add_trigger_entry( $args );
	}