LD_FAILQUIZ::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-failquiz.php

	public function quiz_completed( $data, $current_user ) {

		$q_status = $data['pass'];

		if ( 0 === (int) $q_status ) {



			$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 );
		}
	}