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.
Return Return
(int|false)
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;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 7.8.0 | Introduced. |