LLMS_Template_Loader::restricted_by_course_time_period( array $info )

Handle redirects and messages when a course or associated quiz or lesson has time period date restrictions placed upon it.


Description Description

Quizzes & Lessons redirect to the parent course. Courses display a notice until the course opens and an error once the course closes.


Top ↑

Parameters Parameters

$info

(array) (Required) Array of restriction info from llms_page_restricted().


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/class.llms.template.loader.php

	 * @return void
	 */
	public function restricted_by_course_time_period( $info ) {

		$post_type = get_post_type( $info['content_id'] );

		// If this restriction occurs when attempting to view a lesson,
		// redirect the user to the course, course restriction will handle display of the
		// message once we get there.
		// This prevents duplicate messages from being displayed.
		if ( 'lesson' === $post_type || 'llms_quiz' === $post_type ) {
			$msg      = '';
			$redirect = get_permalink( $info['restriction_id'] );
		}

		if ( ! $msg && ! $redirect ) {
			return;
		}

		// Handle the restriction action & allow developers to filter the results.
		$this->handle_restriction(
			apply_filters( 'llms_restricted_by_course_time_period_message', $msg, $info ),
			apply_filters( 'llms_restricted_by_course_time_period_redirect', $redirect, $info ),
			'notice'
		);


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.