WordPress.org

Ready to get started?Download WordPress

Forums

Limit Login Attempts
Empty login error div shown at all times (2 posts)

  1. marcfalk
    Member
    Posted 2 years ago #

    Whenever I activate the plugin, the login error box is shown at all times - not only when an error occurs. There is no text in the box, unless I manipulate the login error message like this:

    add_filter('login_errors','login_error_message');
    
    	function login_error_message($error){
    	    //check if that's the error you are looking for
    	    $pos = strpos($error, 'incorrect');
    	    if ($pos === false) {
    	        //its the right error so you can overwrite it
    	        $error = "Det indtastede brugernavn eller kodeord var forkert, prov igen.";
    	    }
    	    return $error;
    	}

    Any ideas on what could be the problem?

    http://wordpress.org/extend/plugins/limit-login-attempts/

  2. johanee
    Member
    Plugin Author

    Posted 2 years ago #

    My guess would be that you have some other filter that clears the error message. There has to be some error, or the box divs wouldn't be shown.

    To get the original error message and find which filters are registered you could try something like this:

    <?php
    /*
      Plugin Name: Debug Login Errors
      Description: Debug the login_errors filter
      Author: Johan Eenfeldt
      Version: 0.1
    */
    
    // use the 'all' filter to make sure we get called first
    add_filter('all','debug_login_errors');
    
    function debug_login_errors($filter) {
    	if ($filter != 'login_errors')
    		return;
    
    	$args = func_get_args();
    	if (count($args) < 2)
    		return;
    
    	$error = $args[1];
    
    	// Original error
    	echo '<p>Original error:<br />';
    	var_dump($error);
    	echo '</p>';
    
    	// Filters
    	global $wp_filter;
    	echo '<p>Filters:<br />';
    	var_dump($wp_filter[$filter]);
    	echo '</p>';
    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic