SMF Support > SMF 1.1.x Support

SQL command to delete members with 0 posts under x days old

(1/1)

Rakkar:
So I log in today to find about 10,000 spam accounts registered with the forum. I want to delete all users with 0 posts.

My question is, is this SQL command enough do it correctly? Or do I need to update other tables and stuff too?
Delete from smf_members where posts=0

If I can limit this operation to only accounts created within the last X days that would be even better.

Colin:

--- Code: ---DELETE FROM `smf_members` WHERE `posts` = 0
--- End code ---

MrPhil:

--- Code: ---mysql_query("DELETE FROM `smf_members` WHERE `posts` = 0 AND `dateRegistered` > " . strtotime('2012-05-12'));
--- End code ---

Note that dateRegistered is an integer holding a Unix timestamp, so the normal SQL DATE() function doesn't seem to work with it. Maybe someone else can figure out a way to use pure SQL for this.

Do a SELECT * FROM... first to try it out and make sure you're doing what you want to do!

Edit: SMF 1 uses dateRegistered, SMF 2 uses date_registered

Navigation

[0] Message Index

Go to full version