• Resolved marko4452

    (@marko4452)


    When I set a field to “English letters only”, it doesn’t work and it allows characters like “???汉字” and even numbers. I have tried creating a custom snippet, although it displays an error, the logic behind it doesn’t work. I am a noob when it comes to PHP so I have no idea where the problem is.

    Anyone has any ideas, how can I allow only “A-Z” English letters.

    function um_custom_validate_english_name( $key, $array, $args ) {
        if (!preg_match('/[^A-Za-z0-9]/', $string))  {
            UM()->form()->add_error( $key, __( 'Please use only English letters.', 'ultimate-member' ) );
        }
    }
    add_action( 'um_custom_field_validation_english_name', 'um_custom_validate_english_name', 30, 3 ); 
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Ultimate Member “English letters only” validation doesn’t work’ is closed to new replies.