• Resolved kooogi

    (@kooogi)


    Hi everyone

    Hi everyone

    It is possible to add additional validation / customize messages in password reset form and to do the same thing in register form with username (user_login) field.
    I wrote this code in php and in my opinion it should work but it doesn’t

    add_action( 'um_reset_password_form', 'my_reset_password_form', 10, 1 );
    function my_reset_password_form( $args ) {
        if ( isset( $args['username'] ) ) {
    		if ( isset( UM()->form()->errors['username'] ) ) {
    			unset( UM()->form()->errors['username'] );
    		}
    		if ( empty( $args['username'] ) ) {
    			UM()->form()->add_error( 'username', __( 'Enter username or email address', 'ultimate-member' ) );
    		} elseif ( ! email_exists( $args['username'])  || ! username_exists( $args['username']) ) {
    			UM()->form()->add_error( 'username', __( 'username or email address doesnt exists', 'ultimate-member' ) );
    		}
    	}
    }

    thanks in advance

Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Additional validation + customize error message’ is closed to new replies.