LLMS_REST_Posts_Controller::create_item_permissions_check( WP_REST_Request $request )
Check if a given request has access to create 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/abstracts/class-llms-rest-posts-controller.php
public function create_item_permissions_check( $request ) { $post_type_object = get_post_type_object( $this->post_type ); $post_type_name = $post_type_object->labels->name; if ( ! empty( $request['id'] ) ) { // Translators: %s = The post type name. return llms_rest_bad_request_error( sprintf( __( 'Cannot create existing %s.', 'lifterlms' ), $post_type_name ) ); } if ( ! $this->check_create_permission() ) { // Translators: %s = The post type name. return llms_rest_authorization_required_error( sprintf( __( 'Sorry, you are not allowed to create %s as this user.', 'lifterlms' ), $post_type_name ) ); } if ( ! $this->check_assign_terms_permission( $request ) ) { return llms_rest_authorization_required_error( __( 'Sorry, you are not allowed to assign the provided terms.', 'lifterlms' ) ); } return true; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.0-beta.18 | Use plural post type name. |
1.0.0-beta.1 | Introduced. |