LLMS_Student_Quizzes::get_last_attempt( int $quiz_id )

Retrieve the last recorded attempt for a student for a given quiz/lesson “Last” is defined as the attempt with the highest attempt number


Description Description


Parameters Parameters

$quiz_id

(int) (Required) WP Post ID of the quiz


Top ↑

Return Return

(obj|false)


Top ↑

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;

	}

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: