I am trying to add a new user status in Wordpress. Right now we have two types of user status in Wordpress database 0 or 1. I need a new user status as 7. While user login through wp-login.php page if the user is registered and user_status in database is 7. Need to alert a message stating as "Account Pending. Please validate your email address by clicking on the link sent to your email".
And for remaining users should be able to login.
Here is the code which I am using in theme functions.php file :
<?php
add_filter('wp_authenticate_user', 'myplugin_auth_login',10,1);
function myplugin_auth_login ($user) {
$userstatus=$user->user_status;
if($userstatus=='7')
{
return wp_redirect(get_site_url().'/wp-login.php?action=pending');
}else{
return home_url();
}
}
?>
Another issue in this code is user with status as 0 are not able to login even after entering right username and password. In my current site we are using Buddypress and BP registration options plugin.
please kindly suggest.
Thanks & Regards,