LLMS_Student_Quizzes::get_last_attempt( int $quiz_id )
Retrieve the last recorded attempt for a student for a given quiz/lesson
Description Description
"Last" is defined as the attempt with the highest attempt number
Parameters Parameters
- $quiz_id
-
(int) (Required) WP Post ID of the quiz.
Return Return
(LLMS_Quiz_Attempt|false)
Source Source
File: includes/models/model.llms.student.quizzes.php
public function get_last_attempt( $quiz_id ) {
$attempts = $this->get_attempts_by_quiz(
$quiz_id,
array(
'per_page' => 1,
'sort' => array(
'attempt' => 'DESC',
),
)
);
if ( $attempts ) {
return $attempts[0];
}
return false;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.9.0 | |
| 3.16.0 | Introduced. |