gform_user_registration_validation_message

gform_user_registration_validation_message

DescriptionUsageParametersExamplesPlacementSource Code

Description
This filter is used to customize the default validation message.
Usage
Applies to all forms.
1add_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.
123456789add_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
1$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.

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注