Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @drazenbebic, could you help me with this??? I appreaciate all your help with this amazing plugin

    Thank you Drazen for you feedback. I appreaciate. Well, that’s the problem. We do not know how to send that data. we use de body param of the “wp_remote_get” function of wordpress, and in the validation filter we can handle this data, but we can not get that data to enter in our database. Can you provide me an example of call the api to get that data on the response filter??? Thank you for all your help. This is what we got until now:

    // Make the request
    $remote_url = sprintf('%s%s', $this->endpoint, $license_code);
    $api_params = array(
                'host'   => home_url()
    );
    $response = wp_remote_get( $remote_url, array(
                'headers' => [
                    'Authorization' => 'Basic ' . base64_encode( sprintf( '%s:%s', $this->consumer_key, $this->consumer_secret ) ),
                    'Content-Type' => 'application/json'
                ],
                'method'  => 'GET',
                'timeout' => 45,
                'body'    => $api_params
    ) );

    the host param of body we can access to it in validation filter bu not on the response filter

    Hi Drazen, thanks a lot for the plugin. It’s really a good plugin. I have a question. It’s related with this. You suggest to use a validate filter before any action (Activate, Vaidate, Create) and then if all of this is ok then we can handle the response in another filter “lmfwc_rest_api_pre_response”. Everything looks ok so far. In your example of validation you use an “activation_uuid” meta data with a previous data storage in DB, my question is how we save this data as a previous data??? I mean:

    // Check if the license key already has this UUID
        $previousActivation = lmfwc_get_license_meta($license->getId(), 'activation_uuid', true);
    
        // Throw an error if that's the case
        if ($previousActivation && $previousActivation === $body['uuid']) {
            return new WP_Error(
                'lmfwc_rest_validation_error',
                'The license was already activated using this UUID.',
                array('status' => 403)
            );
        }
    

    In what place or function or filter or action we save the $previousActivation var??? This param we sent to api server and we can use it in “lmfwc_rest_api_validation” with this:

    // Retrieve the body parameters
        $body = $request->get_json_params();

    but in the lmfwc_rest_api_pre_response filter we can not access to this params. Can you provide us a code or example of this??? We appreciate all your help. Thansk in advance. PD: Sorry for my english

Viewing 3 replies - 1 through 3 (of 3 total)