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.
Return Return
(bool) Whether the post can be read.
Source Source
File: libraries/lifterlms-rest/includes/server/class-llms-rest-lessons-controller.php
*
* @param LLMS_Lesson $lesson The Lesson object.
* @return bool Whether the post can be read.
*
* @todo Implement read permission based on the section's id:
* 0 indicates an "orphaned" lesson which can be edited and viewed by instructors and admins but cannot be read by students.
*/
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;
}
Expand full source code Collapse full source code View on GitHub
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. |