Using Gravity Forms ‘gform_chainedselects_column_unique_values_limit ‘ PHP filter

The gform_chainedselects_column_unique_values_limit Gravity Forms PHP filter limits the number of unique values allowed for each column in a Chained Select field.

Usage

add_filter('gform_chainedselects_column_unique_values_limit', 'your_function_name');

Parameters

  • $limit (int): The limit of unique values allowed for each column.

More information

See Gravity Forms Docs: gform_chainedselects_column_unique_values_limit

Examples

Set the limit to 100 unique values

This example sets the limit of unique values for each column to 100.

add_filter('gform_chainedselects_column_unique_values_limit', 'set_limit');

function set_limit($limit) {
    return 100;
}

Set the limit based on user role

This example sets the limit of unique values for each column based on the user’s role.

add_filter('gform_chainedselects_column_unique_values_limit', 'set_limit_based_on_user_role');

function set_limit_based_on_user_role($limit) {
    if (current_user_can('administrator')) {
        return 200;
    } else {
        return 50;
    }
}

Set the limit based on form ID

This example sets the limit of unique values for each column based on the form ID.

add_filter('gform_chainedselects_column_unique_values_limit', 'set_limit_based_on_form_id', 10, 2);

function set_limit_based_on_form_id($limit, $form_id) {
    if ($form_id == 1) {
        return 100;
    } else {
        return 50;
    }
}

Increase the limit by 50

This example increases the limit of unique values for each column by 50.

add_filter('gform_chainedselects_column_unique_values_limit', 'increase_limit_by_50');

function increase_limit_by_50($limit) {
    return $limit + 50;
}

Disable the limit

This example disables the limit of unique values for each column.

add_filter('gform_chainedselects_column_unique_values_limit', 'disable_limit');

function disable_limit($limit) {
    return PHP_INT_MAX;
}