• Resolved Nick

    (@nick7961)


    Hi there,

    I was reading um documentation about validation..about this why is not changing the empty field error message? Please let me know how to do that without plugin..

    add_action('um_custom_field_validation_user_email_details','um_custom_validate_user_email_details', 999, 3);
    
    function um_custom_validate_user_email_details( $key, $array, $args ) {
    
        if ( $key == 'user_email' && isset( $args['user_email'] )) {
    
            if ( $args['user_email'] == '' ) {
                UM()->form()->add_error( 'user_email', __( 'E-mail Address is required', 'ultimate-member' ) );
            } elseif ( !is_email( $args['user_email'] ) ) {
                UM()->form()->add_error( 'user_email', __( 'The email you entered is invalid', 'ultimate-member' ) );
            } elseif ( email_exists( $args['user_email'] ) ) {
                UM()->form()->add_error( 'user_email', __( 'The email you entered is already registered', 'ultimate-member' ) );
            }
        }
    }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change Required Error Message’ is closed to new replies.