@gnanasekaran,
With the code you posted copied into the beginning of my functions.php file, new users are not automatically approved. Even when I remove if the if statement surrounding the approve action, users are not approved automatically.
Any ideas on what is causing the issue? Is the approve function not working properly?
-Chris
/* auto approve for user role when users register */
add_action( ‘user_register’, ‘auto_approve_user’, 10, 1 );
function auto_approve_user( $user_id ) {
//Role based email template
$user_info = get_userdata($user_id);
//get user role
$user_role = $user_info->roles[0];
if($user_role==’subscriber’)
{
do_action( ‘new_user_approve_approve_user’, $user_id );
}
}