[resolved] wp_login returns error (2 posts)

  1. kalico
    Posted 8 years ago #

    I put <?php wp_login(); ?> in my template header, and I am getting this error message:

    Warning: Missing argument 1 for wp_login() in /home/blueribb/public_html/wp-includes/pluggable.php on line 170
    Warning: Missing argument 2 for wp_login() in /home/blueribb/public_html/wp-includes/pluggable.php on line 170

    Here is the function itself, starting at line 170:

    function wp_login($username, $password, $already_md5 = false) {
    	global $wpdb, $error;
    	if ( '' == $username )
    		return false;
    	if ( '' == $password ) {
    		$error = __('<strong>ERROR</strong>: The password field is empty.');
    		return false;
    	$login = get_userdatabylogin($username);
    	//$login = $wpdb->get_row("SELECT ID, user_login, user_pass FROM $wpdb->users WHERE user_login = '$username'");
    	if (!$login) {
    		$error = __('<strong>ERROR</strong>: Invalid username.');
    		return false;
    	} else {
    		// If the password is already_md5, it has been double hashed.
    		// Otherwise, it is plain text.
    		if ( ($already_md5 && md5($login->user_pass) == $password) || ($login->user_login == $username && $login->user_pass == md5($password)) ) {
    			return true;
    		} else {
    			$error = __('<strong>ERROR</strong>: Incorrect password.');
    			$pwd = '';
    			return false;

    Any thoughts as to why I'm getting this error? I put the function call for wp_register right before that, and it comes out just fine.


  2. kalico
    Posted 8 years ago #

    I discovered that <?php wp_loginout(); ?> worked just fine. Odd, since the function "wp_login" is defined and works in the Kubrick theme, on the exact same blog...maybe something different about my theme??....but hey, it works now, so I'm good.

    (And for the record, everything works lots better when you turn on "anyone can register" in Admin >> Options >> General. :P )


Topic Closed

This topic has been closed to new replies.

About this Topic