wpmdb_ajax_cap

wpmdb_ajax_cap

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: wp-migrate-db.2.6.9

apply_filters('wpmdb_ajax_cap') is found 3 times:

  • /class/Common/Http/Helper.php line 100
     
    		$_POST = $_REQUEST = json_decode(file_get_contents('php://input'), true);
    
    		$cap = (is_multisite()) ? 'manage_network_options' : 'export';
    		$cap = apply_filters('wpmdb_ajax_cap', $cap);
    
    		if (!current_user_can($cap)) {
    			self::$http->end_ajax(
    				new \WP_Error(
    					'wpmdb-convert-json-post-error',
    					__('Invalid Request. Did you pass the correct nonce?', 'wp-migrate-db')
    
  • /class/Common/Http/Http.php line 136
                return $this->end_ajax(new \WP_Error('wpmdb_invalid_nonce', sprintf(__('Invalid nonce for: %s', 'wp-migrate-db'), $action)));
            }
    
            $cap = (is_multisite()) ? 'manage_network_options' : 'export';
            $cap = apply_filters('wpmdb_ajax_cap', $cap);
    
            if (!current_user_can($cap)) {
                $return = array('wpmdb_error' => 1, 'body' => sprintf(__('Access denied for: %s', 'wp-migrate-db'), $action));
                $this->end_ajax(json_encode($return));
            }
        }
    
  • /class/Common/Http/WPMDBRestAPIServer.php line 22
    	}
    
    	public function permission_callback() {
    		$cap = is_multisite() ? 'manage_network_options' : 'export';
    		$cap = apply_filters( 'wpmdb_ajax_cap', $cap );
    
    		// Restrict endpoint to only users who have the edit_posts capability.
    		if ( ! current_user_can( $cap ) ) {
    			return new \WP_Error( 'rest_forbidden', esc_html__( 'Only authenticated users can access endpoint.', 'wp-migrate-db' ), [ 'status' => 401 ] );
    		}