From b406edc0ac29322947dea6ffbb5f39979db2eaad Mon Sep 17 00:00:00 2001 From: ashubawork Date: Fri, 2 Feb 2024 12:18:16 +0200 Subject: [PATCH] - add english letters validation --- includes/core/um-actions-form.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/includes/core/um-actions-form.php b/includes/core/um-actions-form.php index 1cbf29e5..8cde2e5d 100644 --- a/includes/core/um-actions-form.php +++ b/includes/core/um-actions-form.php @@ -1016,6 +1016,16 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) { break; + case 'english': + if ( '' !== $submitted_data[ $key ] ) { + + if ( ! preg_match( '/^[a-zA-Z]*$/u', str_replace( ' ', '', $submitted_data[ $key ] ) ) ) { + UM()->form()->add_error( $key, __( 'You must provide english letters', 'ultimate-member' ) ); + } + } + + break; + } } // end if ( isset in args array )