LLMS_Student_Quizzes::get_last_completed_attempt( $quiz_id = null,  $deprecated = null )

Get the last completed attempt for a given quiz or quiz/lesson combination


Description Description


Parameters Parameters

$quiz

(int) (Required) WP Post ID of a Quiz

$lesson

(int) (Required) WP Post ID of a Lesson


Top ↑

Return Return

(false|obj)


Top ↑

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;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.9.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.





Permalink: