Last active
December 21, 2015 02:09
-
-
Save ziadoz/6233358 to your computer and use it in GitHub Desktop.
Mass Delete Vanilla Forum Spam Users
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Delete Spammers. | |
delete from GDN_User where ((CountDiscussions = 0 and CountComments = 0) or About != '' or Name = '[Deleted User]') and Admin = 0; | |
delete from GDN_User where CountVisits = 0 and Admin = 0; | |
delete from GDN_UserRole where UserID not in (select UserID from GDN_User); | |
-- Cleanup Data. | |
delete from GDN_Discussion where InsertUserID not in (select UserID from GDN_User); | |
delete from GDN_Comment where InsertUserID not in (select UserID from GDN_User); | |
delete from GDN_UserDiscussion where UserID not in (select UserID from GDN_User); | |
delete from GDN_Session where UserID not in (select UserID from GDN_User); | |
delete from GDN_Activity where ActivityUserID not in (select UserID from GDN_User); | |
delete from GDN_AntiSpamLog where UserID not in (select UserID from GDN_User); | |
delete from GDN_Log where InsertUserID not in (select UserID from GDN_User); | |
-- Need to update GDN_Category CountDiscussions and CountComments values with SQL too. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment