Grunion_Contact_Form_Endpoint

Class Grunion_Contact_Form_Endpoint Used as 'rest_controller_class' parameter when 'feedback' post type is registered in modules/contact-form/grunion-contact-form.php.

Defined (1)

The class is defined in the following location(s).

/modules/contact-form/class-grunion-contact-form-endpoint.php  
  1. class Grunion_Contact_Form_Endpoint extends WP_REST_Posts_Controller { 
  2. /** 
  3. * Check whether a given request has proper authorization to view feedback items. 
  4. * @param WP_REST_Request $request Full details about the request. 
  5. * @return WP_Error|boolean 
  6. */ 
  7. public function get_items_permissions_check( $request ) { 
  8. if ( ! is_user_member_of_blog( get_current_user_id(), get_current_blog_id() ) ) { 
  9. return new WP_Error( 
  10. 'rest_cannot_view',  
  11. esc_html__( 'Sorry, you cannot view this resource.', 'jetpack' ),  
  12. array( 'status' => 401 ) 
  13. ); 
  14.  
  15. return true; 
  16.  
  17. /** 
  18. * Check whether a given request has proper authorization to view feedback item. 
  19. * @param WP_REST_Request $request Full details about the request. 
  20. * @return WP_Error|boolean 
  21. */ 
  22. public function get_item_permissions_check( $request ) { 
  23. if ( ! is_user_member_of_blog( get_current_user_id(), get_current_blog_id() ) ) { 
  24. return new WP_Error( 
  25. 'rest_cannot_view',  
  26. esc_html__( 'Sorry, you cannot view this resource.', 'jetpack' ),  
  27. array( 'status' => 401 ) 
  28. ); 
  29.  
  30. return true; 
  31.