LLMS_REST_Enrollments_Controller::check_read_permission( mixed $enrollment )
Checks if an enrollment can be read.
Parameters Parameters
- $enrollment
-
(mixed) (Required) The enrollment object.
Return Return
(bool) Whether the enrollment can be read.
Source Source
File: libraries/lifterlms-rest/includes/server/class-llms-rest-enrollments-controller.php
protected function check_read_permission( $enrollment ) { /** * As of now, enrollments of password protected courses cannot be read */ if ( isset( $enrollment->post_id ) && post_password_required( $enrollment->post_id ) ) { return false; } if ( get_current_user_id() === (int) $enrollment->student_id ) { return true; } return current_user_can( 'view_students', $enrollment->student_id ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.0-beta.4 | The single enrollment can be read only by who can view the enrollment's student. |
1.0.0-beta.1 | Introduced. |