Using Gravity Forms ‘gform_settings_display_license_details’ PHP filter

The gform_settings_display_license_details filter allows you to control the display of the license details panel on the Forms > Settings page in Gravity Forms.

Usage

To use the filter, add the following code:

add_filter('gform_settings_display_license_details', 'your_function_name');

Parameters

  • $display_license_details (bool): Indicates if the license details panel should be displayed. Default is true.

More information

See Gravity Forms Docs: gform_settings_display_license_details This filter was added in Gravity Forms v2.5.16.4. The source code can be found in GFSettings::plugin_settings_fields() in settings.php.

Examples

Remove License Details

Remove the “Your License Details” panel from the Forms > Settings page:

add_filter('gform_settings_display_license_details', '__return_false');

Place this code in the functions.php file of the active theme, a custom functions plugin, or a custom add-on.

Display License Details

Force the display of the “Your License Details” panel on the Forms > Settings page:

function show_license_details($display_license_details) {
    return true;
}
add_filter('gform_settings_display_license_details', 'show_license_details');

Display License Details Based on User Role

Display the “Your License Details” panel only for administrators:

function display_license_for_admins($display_license_details) {
    if (current_user_can('activate_plugins')) {
        return true;
    } else {
        return false;
    }
}
add_filter('gform_settings_display_license_details', 'display_license_for_admins');

Display License Details Based on Custom Capability

Display the “Your License Details” panel only for users with a custom capability, like ‘manage_licenses’:

function display_license_for_custom_capability($display_license_details) {
    if (current_user_can('manage_licenses')) {
        return true;
    } else {
        return false;
    }
}
add_filter('gform_settings_display_license_details', 'display_license_for_custom_capability');

Toggle License Details Display

Toggle the display of the “Your License Details” panel based on a custom condition:

function toggle_license_details_display($display_license_details) {
    // Your custom condition here
    $condition = true;

    if ($condition) {
        return true;
    } else {
        return false;
    }
}
add_filter('gform_settings_display_license_details', 'toggle_license_details_display');