开发者

how to delete unverified users in buddypress

开发者 https://www.devze.com 2023-03-09 19:06 出处:网络
I am using buddypress and wordpress. There are a lot of registered but unverified members in my user list. How do I automatically delete an unverified user based on time (like开发者_JS百科 a week)?

I am using buddypress and wordpress. There are a lot of registered but unverified members in my user list. How do I automatically delete an unverified user based on time (like开发者_JS百科 a week)?

These unverified user have been accumulated over time and i need to manually delete them which is a confusing task, so is there a plugin which automatically deletes unverified users or do I need code?


After a long gap I found out, it's just a simple query to delete users who are inactive for more than 30 days..

function spammersdeletion() {
    global $wpdb;
    $from = strtotime('-30 day', time());
    $wpdb->query('DELETE FROM wp_users WHERE DATE(user_registered) < "'.date('Y-m-d', $from).'"AND user_status = "2"');
}

add_action('init','spammersdeletion');

Add this code to your function.php and that it all your spam user would be gone in 30 days.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号