LLMS_Quiz_Attempt::get_question( int $question_id, string $return = 'id' )

Retrieve the question in the attempt.


Parameters Parameters

$question_id

(int) (Required) WP Post ID of the required LLMS_Question.

$return

(string) (Optional) Return type 'id|array'. Default 'id'.

Default value: 'id'


Top ↑

Return Return

(int|array|false)


Top ↑

Source Source

File: includes/models/model.llms.quiz.attempt.php

	public function get_question( $question_id, $return = 'id' ) {

		$ids   = array_map( 'intval', array_column( $this->get_questions(), 'id' ) );
		$index = array_search( (int) $question_id, $ids, true );
		return $index >= 0 ?
			'id' === $return ? $question_id : $this->get_questions()[ $index ]
			:
			false;
	}


Top ↑

Changelog Changelog

Changelog
Version Description
7.8.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.