Using Gravity Forms ‘gform_currency_disabled’ PHP action

The gform_currency_disabled filter enables or disables the currency drop down on the settings page in Gravity Forms.

Usage

add_filter('gform_currency_disabled', 'your_custom_function');
function your_custom_function($is_disabled) {
    // your custom code here
    return $is_disabled;
}

Parameters

  • $is_disabled (string): Value to be filtered. Use “true” to disable the currency drop down. Use “false” to enable it.

More information

See Gravity Forms Docs: gform_currency_disabled

Examples

Disable the currency drop down

Disables the currency drop down in the settings page.

add_filter('gform_currency_disabled', '__return_true');

Enable the currency drop down

Enables the currency drop down in the settings page.

add_filter('gform_currency_disabled', '__return_false');

Enable the currency drop down for specific user roles

Enables the currency drop down in the settings page only for users with the ‘administrator’ role.

add_filter('gform_currency_disabled', 'enable_currency_for_admins');
function enable_currency_for_admins($is_disabled) {
    if (current_user_can('administrator')) {
        return false;
    }
    return $is_disabled;
}

Disable the currency drop down based on a custom condition

Disables the currency drop down in the settings page if a custom condition is met.

add_filter('gform_currency_disabled', 'disable_currency_based_on_condition');
function disable_currency_based_on_condition($is_disabled) {
    $custom_condition = true; // Replace with your custom condition.

    if ($custom_condition) {
        return true;
    }
    return $is_disabled;
}

Enable the currency drop down based on a custom condition

Enables the currency drop down in the settings page if a custom condition is met.

add_filter('gform_currency_disabled', 'enable_currency_based_on_condition');
function enable_currency_based_on_condition($is_disabled) {
    $custom_condition = true; // Replace with your custom condition.

    if ($custom_condition) {
        return false;
    }
    return $is_disabled;
}