我目前正试图通过使用Authenticate过滤器覆盖Wordpress add_filter( 'authenticate', 'myplugin_auth_signon', 30, 3 );
function myplugin_auth_signon( $user, $username, $password ) {
if(isset($_POST['wp-submit'])){
$creds = array();
$creds['user_login'] = $_POST['log'];
$creds['user_password'] = $_POST['pwd'];
$creds['remember'] = true;
$my_error = new WP_Error();
$userid = get_user_by( 'login', $_POST['log'] );
echo $userid = $userid->ID;
$meta = get_usermeta( $userid, 'is_active' );
if($meta == '0'){
echo "please verify account first |||||";
return 0;
}else{
return $user;
}
}
}
,一切看起来都很完美,但功能总是运行多次。
Machine ec-2 M3 Medium on AWS
RAM : 4GB
DISK : 30GB
Processors : Intel Xeon E5-2670 v2 (Ivy Bridge) Processors