1

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?

Steve Lillis
  • 3,263
  • 5
  • 22
  • 41
Ezhil
  • 389
  • 1
  • 4
  • 18

1 Answers1

2

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.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Ezhil
  • 389
  • 1
  • 4
  • 18