LLMS_Template_Loader::restricted_by_quiz( array $info )

Handle attempts to access quizzes.


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_quiz( $info ) {

		$msg      = '';
		$redirect = '';

		if ( get_current_user_id() ) {

			$msg  = __( 'You must be enrolled in the course to access this quiz.', 'lifterlms' );
			$quiz = llms_get_post( $info['restriction_id'] );
			if ( $quiz ) {
				$course = $quiz->get_course();
				if ( $course ) {
					$redirect = get_permalink( $course->get( 'id' ) );
				}
			}
		} else {

			$msg      = __( 'You must be logged in to take quizzes.', 'lifterlms' );
			$redirect = llms_person_my_courses_url();

		}

		$this->handle_restriction(
			apply_filters( 'llms_restricted_by_membership_message', $msg, $info ),
			apply_filters( 'llms_restricted_by_membership_redirect', $redirect, $info ),
			'error'
		);


Top ↑

Changelog Changelog

Changelog
Version Description
3.16.1 Unknown.
3.1.6 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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