LLMS_Quiz_Attempt::get_previous_question( int $question_id )

Retrieve the previous question in the attempt relative to a given question ID.


Parameters Parameters

$question_id

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


Top ↑

Return Return

(int|false)


Top ↑

Source Source

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

	public function get_previous_question( $question_id ) {

		$next = false;

		foreach ( array_reverse( $this->get_questions() ) as $question ) {

			if ( $next ) {

				return $question['id'];

			} elseif ( $question_id && absint( $question_id ) === absint( $question['id'] ) ) {
				$next = true;
			}
		}

		return 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.