LLMS_Student_Quizzes::get_last_completed_attempt( int $quiz_id = null, int $deprecated = null )
Get the last completed attempt for a given quiz or quiz/lesson combination
Parameters Parameters
- $quiz_id
-
(int) (Optional) WP Post ID of a Quiz.
Default value: null
- $deprecated
-
(int) (Optional) Deprecated.
Default value: null
Return Return
(false|LLMS_Quiz_Attempt)
Source Source
File: includes/models/model.llms.student.quizzes.php
public function get_last_completed_attempt( $quiz_id = null, $deprecated = null ) { $query = new LLMS_Query_Quiz_Attempt( array( 'student_id' => $this->get_id(), 'quiz_id' => $quiz_id, 'per_page' => 1, 'status_exclude' => array( 'incomplete' ), 'sort' => array( 'end_date' => 'DESC', 'id' => 'DESC', ), ) ); if ( $query->has_results() ) { return $query->get_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. |