[wp-testers] Re: wp-login.php

an at horttcore.de an at horttcore.de
Sun Mar 16 22:30:35 GMT 2008


//======================================
// Description: Checks if the user is authenticated

add_action('wp_authenticate','cur_authenticate');

Function cur_authenticate(){
	global $user_login, $errors;
	if ($user_login && !empty($_POST)) {
		
		$userid  = get_useridbylogin($user_login);
				
		if (!is_authenticated($userid) && isset($userid)) {
			array_push($errors,'Fehler: Ihr Account wurde noch nicht  
zugelassen.');
		}
	}
}

This function works in WP 2.3.3 and breaks in WP 2.5.
I tried to change it to this:

//======================================
// Description: Checks if the user is authenticated

add_action('wp_login','cur_authenticate');

Function cur_authenticate($user_login){
	global $user;
			
		$userid  = get_useridbylogin($user_login);
				
		if (!is_authenticated($userid)) {
			$error = '<strong>ERROR:</strong> Your account has to be confirmed  
by an administrator before you can login';
			$user = new WP_Error();
			$user->add('user_login',$error);
			#die(print_r($user));
		}
}

Whatever I try I'm unable to block the login via an hook. I could use  
die() and create an output that looks like the login page. But thats  
not right imo.


More information about the wp-testers mailing list