Using Gravity Forms ‘gform_highrise_verifypeer’ PHP filter

The gform_highrise_verifypeer filter in the Gravity Forms Highrise Add-On allows the cURL CURLOPT_SSL_VERIFYPEER option to be enabled or disabled.

Usage

add_filter('gform_highrise_verifypeer', 'your_function_name', 10, 1);

Parameters

  • is_enabled (bool) – True to enable peer verification. False to bypass peer verification. Defaults to true.

More information

See Gravity Forms Docs: gform_highrise_verifypeer

Examples

Disable CURLOPT_SSL_VERIFYPEER

This example disables the CURLOPT_SSL_VERIFYPEER option by returning false.

add_filter('gform_highrise_verifypeer', 'disable_verifypeer', 10, 1);

function disable_verifypeer($is_enabled) {
    return false;
}

Enable CURLOPT_SSL_VERIFYPEER

This example enables the CURLOPT_SSL_VERIFYPEER option by returning true.

add_filter('gform_highrise_verifypeer', 'enable_verifypeer', 10, 1);

function enable_verifypeer($is_enabled) {
    return true;
}

Enable CURLOPT_SSL_VERIFYPEER based on a specific condition

This example enables the CURLOPT_SSL_VERIFYPEER option based on a specific condition (e.g., the current user has a specific role).

add_filter('gform_highrise_verifypeer', 'conditionally_enable_verifypeer', 10, 1);

function conditionally_enable_verifypeer($is_enabled) {
    // Replace 'administrator' with the desired user role
    if (current_user_can('administrator')) {
        return true;
    }
    return false;
}

Disable CURLOPT_SSL_VERIFYPEER for local development

This example disables the CURLOPT_SSL_VERIFYPEER option only for local development environment.

add_filter('gform_highrise_verifypeer', 'disable_verifypeer_local_dev', 10, 1);

function disable_verifypeer_local_dev($is_enabled) {
    if ($_SERVER['SERVER_NAME'] === 'localhost') {
        return false;
    }
    return $is_enabled;
}

Enable or disable CURLOPT_SSL_VERIFYPEER based on a custom filter

This example enables or disables the CURLOPT_SSL_VERIFYPEER option based on the result of a custom filter named ‘my_custom_filter’.

add_filter('gform_highrise_verifypeer', 'custom_verifypeer', 10, 1);

function custom_verifypeer($is_enabled) {
    // Replace 'my_custom_filter' with the desired custom filter
    return apply_filters('my_custom_filter', $is_enabled);
}