LLMS_REST_Enrollments_Controller::delete_item_permissions_check( WP_REST_Request $request )
Check if a given request has access to delete an item.
Parameters Parameters
- $request
-
(WP_REST_Request) (Required) Full details about the request.
Return Return
(WP_Error|boolean)
Source Source
File: libraries/lifterlms-rest/includes/server/class-llms-rest-enrollments-controller.php
$response = $this->prepare_item_for_response( $enrollment, $request ); return $response; } /** * Check if a given request has access to delete an item. * * @since 1.0.0-beta.1 * @since 1.0.0-beta.10 The`trigger` param is now taken into account. * @since 1.0.0-beta.18 Provide a more significant error message when trying to delete an item without permissions. * * @param WP_REST_Request $request Full details about the request. * @return WP_Error|boolean */ public function delete_item_permissions_check( $request ) { $enrollment_exists = $this->enrollment_exists( (int) $request['id'], (int) $request['post_id'], $request['trigger'] ); if ( is_wp_error( $enrollment_exists ) ) { // Enrollment not found, we don't return a 404. if ( in_array( 'llms_rest_not_found', $enrollment_exists->get_error_codes(), true ) ) { return true; } return $enrollment_exists;
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.0-beta.18 | Provide a more significant error message when trying to delete an item without permissions. |
1.0.0-beta.1 | Introduced. |