gform_user_registration_validation_message

Description

This filter is used to customize the default validation message.

Usage

Applies to all forms.

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

Parameters

  • $message string

    The validation message for the current validation error.

  • $form Form Object

    The form currently being processed.

Examples

This example demonstrates how to check which message is passed through the filter and then modifies that message when the correct validation message is found.

add_filter( 'gform_user_registration_validation_message', 'update_validation_msgs', 10, 2 );
function update_validation_msgs( $message, $form ) {

    if ( $message == 'This username is already registered' ) {
        $message = "We're sorry, this username is already registered. Try submitting with a different username.";
    }

    return $message;
}

Placement

This code should be placed in the functions.php file of your active theme.

Source Code

$field->validation_message = apply_filters( 'gform_user_registration_validation_message', $message, $form );

This filter is located in GF_User_Registration::add_validation_error() in class-gf-user-registration.php.