LLMS_Quiz_Attempt::get_next_question( int $last_question = null )
Retrieve the next unanswered question in the attempt
Parameters Parameters
- $last_question
-
(int) (Optional) WP Post ID of the current LLMS_Question the "next" refers to. Default
null
.Default value: null
Return Return
(int|false)
Source Source
File: includes/models/model.llms.quiz.attempt.php
* @return int|false */ public function get_next_question( $last_question = null ) { $next = false; foreach ( $this->get_questions() as $question ) { if ( $next || is_null( $question['answer'] ) ) { return $question['id']; // When rewinding and moving back through we don't want to skip questions. } elseif ( $last_question && absint( $last_question ) === absint( $question['id'] ) ) { $next = true; } } return false;
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
4.2.0 | Use strict type comparison. |
3.9.0 | |
3.16.0 | Introduced. |