LLMS_REST_Students_Progress_Controller::validate_post_id( int $value, WP_REST_Request $request, string $param )
Validate the path parameter “post_id”.
Parameters Parameters
- $value
-
(int) (Required) Post ID.
- $request
-
(WP_REST_Request) (Required) Request object.
- $param
-
(string) (Required) Parameter name ("post_id").
Return Return
(bool)
Source Source
File: libraries/lifterlms-rest/includes/server/class-llms-rest-students-progress-controller.php
* @param int $value Post ID. * @param WP_REST_Request $request Request object. * @param string $param Parameter name ("post_id"). * @return bool */ public function validate_post_id( $value, $request, $param ) { $post = get_post( $value ); if ( ! $post ) { return false; } elseif ( ! in_array( $post->post_type, array( 'course', 'lesson', 'section' ), true ) ) { return false; } elseif ( 'DELETE' !== $request->get_method() && ! llms_is_user_enrolled( $request['id'], $value ) ) {
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.0-beta.25 | Skip enrollment validation for DELETE request method. |
1.0.0-beta.1 | Introduced. |