LLMS_REST_Lessons_Controller::check_read_permission( LLMS_Lesson $lesson )

Checks if a Lesson can be read


Parameters Parameters

$lesson

(LLMS_Lesson) (Required) The Lesson object.


Top ↑

Return Return

(bool) Whether the post can be read.


Top ↑

Source Source

File: libraries/lifterlms-rest/includes/server/class-llms-rest-lessons-controller.php

	protected function check_read_permission( $lesson ) {

		/**
		 * As of now, lessons of password protected courses cannot be read
		 */
		if ( post_password_required( $lesson->get( 'parent_course' ) ) ) {
			return false;
		}

		/**
		 * At the moment we grant lessons read permission only to who can edit lessons.
		 */
		return parent::check_update_permission( $lesson );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.23 Replaced the call to the deprecated LLMS_Lesson::get_parent_course() method with LLMS_Lesson::get( 'parent_course' ).
1.0.0-beta.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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