LLMS_Quiz::is_open( int $user_id = null )

Determine if a student can take the quiz


Description Description


Parameters Parameters

$user_id

(int) (Optional) WP User ID, none supplied uses current user

Default value: null


Top ↑

Return Return

(boolean)


Top ↑

Source Source

File: includes/models/model.llms.quiz.php

	public function is_open( $user_id = null ) {

		$student = llms_get_student( $user_id );
		if ( ! $student ) {
			return false;
		}

		$remaining = $student->quizzes()->get_attempts_remaining_for_quiz( $this->get( 'id' ) );

		// string for "unlimited" or number of attempts
		if ( ! is_numeric( $remaining ) || $remaining > 0 ) {
			return true;
		}

		return false;

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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





Permalink: