Support » Plugin: Theme My Login » Errors showing on login page before submission

  • Resolved f1alan

    (@f1alan)


    I have version 7.0.13 of Theme My Login installed and WordPress 5.2.

    If I simply navigate to /login then I see the following errors that I’d only expect on submit:

    “ERROR: the username field is empty.” and “ERROR: the password field is empty.”

    If I submit the /lostpassword form then I see the same errors as well as “Check your e-mail for the confirmation link.”.

    Everything works and this is just a cosmetic issue.

    I looked at the render_errors() function in class-theme-my-login-form.php and saw the “login_errors” filter. One option was to override this but you still get an empty error message. Another option that worked was to override ‘authenticate’ and return an empty WP_Error array but this broke other parts of our site.

    In the end, I modified the render_errors() function as follows:

    if(isset($_POST['submit']))
    {
    	if ( ! empty( $errors ) ) {
    		$output .= sprintf( '<ul class="tml-errors"><li class="tml-error">%s</li></ul>',
    			apply_filters( 'login_errors', implode( "</li>\n<li class=\"tml-error\">", $errors ) )
    		);
    	}
    }

    I don’t like hacking plugins but this will work for now. It would be good if this bug could be solved in a future update.

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Errors showing on login page before submission’ is closed to new replies.