Using Gravity Forms ‘gform_user_registration_config_validation’ PHP filter

The gform_user_registration_config_validation Gravity Forms filter was used to validate custom settings/meta specified using the gform_user_registration_add_option_section or gform_user_registration_add_option_group action hooks. This filter was removed in version 3.0. New feed settings defined using gform_userregistration_feed_settings_fields can be validated by defining the validation_callback property for the field.

Usage

add_filter('gform_user_registration_config_validation', 'your_function_name', 10, 2);

Parameters

  • $is_validation_error (array) – Boolean value indicating whether there was a validation error with the User Registration configuration.
  • $config (array) – The User Registration configuration array.

More information

See Gravity Forms Docs: gform_user_registration_config_validation

Note: The gform_user_registration_config_validation filter has been removed since Gravity Forms version 3.0.

Examples

Validate Multisite Configuration

This example demonstrates how to validate the custom option fields added using the gform_user_registration_add_option_section hook to support multisite options.

add_filter('gform_user_registration_config_validation', 'validate_multisite_config', 10, 2);

public static function validate_multisite_config($is_validation_error, $config) {
    $multisite_options = $config['meta']['multisite_options'];

    // Check if 'create_site' is empty
    if (empty($multisite_options['create_site'])) {
        return $is_validation_error;
    }

    // Check if 'site_address' or 'site_title' are empty
    if (empty($multisite_options['site_address']) || empty($multisite_options['site_title'])) {
        return true;
    }

    return $is_validation_error;
}