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.


Top ↑

Return Return

(bool)


Top ↑

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


Top ↑

Changelog Changelog

Changelog
Version Description
7.8.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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