Automator_Review::uo_register_api_for_reviews()

Register rest api calls for misc tasks.

Contents

  • Changelog

  • Source Source

    File: src/core/admin/class-automator-review.php

    	public function uo_register_api_for_reviews() {
    		global $wpdb;
    		$check_closure = $wpdb->get_col( "SELECT cp.ID as ID FROM {$wpdb->posts} cp LEFT JOIN {$wpdb->posts} rp ON rp.ID = cp.post_parent WHERE cp.post_type LIKE 'uo-closure' AND cp.post_status LIKE 'publish' AND rp.post_status LIKE 'publish' LIMIT 1" );
    		if ( ! empty( $check_closure ) ) {
    			register_rest_route(
    				AUTOMATOR_REST_API_END_POINT,
    				'/uoa_redirect/',
    				array(
    					'methods'             => 'POST',
    					'callback'            => array( $this, 'send_feedback' ),
    					'permission_callback' => function () {
    						return true;
    					},
    				)
    			);
    		}
    
    		register_rest_route(
    			AUTOMATOR_REST_API_END_POINT,
    			'/review-banner-visibility/',
    			array(
    				'methods'             => 'POST',
    				'callback'            => array( $this, 'save_review_settings' ),
    				'permission_callback' => function () {
    					if ( is_user_logged_in() && current_user_can( 'manage_options' ) ) {
    						return true;
    					}
    
    					return false;
    				},
    			)
    		);
    	}
    

    Changelog Changelog

    Changelog
    Version Description
    2.1.0 Introduced.