Using Gravity Forms ‘gform_square_show_custom_app_settings’ PHP filter

The gform_square_show_custom_app_settings filter allows you to display a custom app settings link in the Square add-on settings page in Gravity Forms.

Usage

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

Parameters

  • $show_settings (bool): Defaults to false. Return true to show custom app settings.

More information

See Gravity Forms Docs: gform_square_show_custom_app_settings

Examples

To display the custom app settings link, return true in your function.

function enable_custom_app_settings($show_settings) {
    return true;
}

add_filter('gform_square_show_custom_app_settings', 'enable_custom_app_settings', 10, 1);

Display the custom app settings link only for users with a specific role.

function show_custom_app_settings_for_role($show_settings) {
    $user = wp_get_current_user();

    if (in_array('your_specific_role', $user->roles)) {
        return true;
    }

    return $show_settings;
}

add_filter('gform_square_show_custom_app_settings', 'show_custom_app_settings_for_role', 10, 1);

Show the custom app settings link only for a specific form ID.

function show_custom_app_settings_for_form($show_settings) {
    $form_id = rgget('id');

    if ($form_id == 'your_specific_form_id') {
        return true;
    }

    return $show_settings;
}

add_filter('gform_square_show_custom_app_settings', 'show_custom_app_settings_for_form', 10, 1);

Hide the custom app settings link for a specific user ID.

function hide_custom_app_settings_for_user($show_settings) {
    $user_id = get_current_user_id();

    if ($user_id == 'your_specific_user_id') {
        return false;
    }

    return $show_settings;
}

add_filter('gform_square_show_custom_app_settings', 'hide_custom_app_settings_for_user', 10, 1);

Show the custom app settings link only during a specific date range.

function show_custom_app_settings_based_on_date($show_settings) {
    $start_date = strtotime('2023-01-01');
    $end_date = strtotime('2023-12-31');
    $current_date = strtotime(current_time('Y-m-d'));

    if ($current_date >= $start_date && $current_date <= $end_date) {
        return true;
    }

    return $show_settings;
}

add_filter('gform_square_show_custom_app_settings', 'show_custom_app_settings_based_on_date', 10, 1);