LLMS_Template_Loader::__construct()

Constructor.


Source Source

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

	public function __construct() {

		// Template loading for FSE themes.
		add_action( 'template_redirect', array( $this, 'hook_block_template_loader' ) );

		/**
		* Filters the template loading priority.
		*
		* Callback for the WP core filter `template_include`.
		*
		* @since 6.2.0
		*
		* @param int $priority The filter callback priority.
		*/
		$template_loader_cb_priority = apply_filters( 'llms_template_loader_priority', 10 );
		/**
		 * Do template loading.
		 *
		 * The default priority is 10, so to allow theme builders, like Divi and Elementor (Pro),
		 * to override our templates (except single content restricted).
		 * see https://github.com/gocodebox/lifterlms/issues/2111
		 */
		add_filter( 'template_include', array( $this, 'template_loader' ), $template_loader_cb_priority );

		add_action( 'rest_api_init', array( $this, 'maybe_prepare_post_content_restriction' ) );

		// Restriction actions for each kind of restriction.
		$reasons = apply_filters(
			'llms_restriction_reasons',
			array(
				'course_prerequisite',
				'course_track_prerequisite',
				'course_time_period',
				'enrollment_lesson',
				'lesson_drip',
				'lesson_prerequisite',
				'membership',
				'sitewide_membership',
				'quiz',
			)
		);

		foreach ( $reasons as $reason ) {
			add_action( 'llms_content_restricted_by_' . $reason, array( $this, 'restricted_by_' . $reason ), 10, 1 );
		}

		add_action( 'wp', array( $this, 'maybe_redirect_to_sales_page' ) );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
6.4.0 Reverted back the priority of the $this->template_loader() callback (template_include hook's callback) from 100 to 10.
6.2.0 Added 'llms_template_loader_priority' filter.
5.8.0 Handle block templates loading.
3.41.1 Predispose posts content restriction in REST requests.
3.20.0 Unknown.
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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