Ezhil
Ezhil

Reputation: 389

how to delete unverified users in buddypress

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 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?

Upvotes: 1

Views: 1071

Answers (1)

Ezhil
Ezhil

Reputation: 389

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.

Upvotes: 2

Related Questions