LLMS_Quiz_Attempt::has_resume_attempt_time_expired()
Determine if the student’s resume quiz attempt time limit is expired.
Description Description
The default resume quiz attempt time limit for a student is 1 day.
Return Return
(bool)
Source Source
File: includes/models/model.llms.quiz.attempt.php
public function has_resume_attempt_time_expired() {
$student = llms_get_student();
if ( ! $student ) {
return false;
}
if ( ! $this->get( 'start_date' ) ) {
return false;
}
$start_date = $this->get( 'start_date' );
/**
* Filters the X time for resuming quiz.
*
* @since 7.8.0
*
* @param int $resume_time_period The time period in hours.
*/
$resume_time_period = apply_filters( 'llms_quiz_attempt_resume_time_period', 24, $this );
$start_date_obj = new DateTime( $start_date, wp_timezone() );
$current_date_obj = current_datetime();
return $current_date_obj > $start_date_obj->modify( sprintf( '+%d hours', intval( $resume_time_period ) ) );
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 7.8.0 | Introduced. |