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
Return Return
(boolean)
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; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: