Stuart Wright
Well-known member
There are thousands.
Thanks Jake but there were hundreds of spammers which needed all their posts deleting.
I haven't used Xenforo admin CP in anger until the last couple of days. There is *so* much functionality missing which I take for granted in vB3.
In the admin CP, you can't even see the date people registered !
A range of userids would do it.
UPDATE xf_post
SET message_state = 'deleted'
WHERE message_state = 'visible'
AND user_id BETWEEN 2 and 10;
INSERT INTO xf_deletion_log (content_type, content_id, delete_date, delete_user_id, delete_username, delete_reason)
SELECT 'post', post_id, UNIX_TIMESTAMP(), 1, 'admin', 'manually deleted via query'
FROM xf_post
WHERE message_state = 'deleted'
AND user_id BETWEEN 2 and 10
ON DUPLICATE KEY UPDATE
content_id = VALUES(content_id);
UPDATE xf_thread
SET discussion_state = 'deleted'
WHERE discussion_state = 'visible'
AND user_id BETWEEN 2 and 10;
INSERT INTO xf_deletion_log (content_type, content_id, delete_date, delete_user_id, delete_username, delete_reason)
SELECT 'thread', thread_id, UNIX_TIMESTAMP(), 1, 'admin', 'manually deleted via query'
FROM xf_thread
WHERE discussion_state = 'deleted'
AND user_id BETWEEN 2 and 10
ON DUPLICATE KEY UPDATE
content_id = VALUES(content_id);
Range of user_ids it is.
Try these queries. The red is the range of user_ids whose posts and threads you want to soft delete (the range is inclusive of the boundaries). The blue is the deletion info (user_id and username of the user who is doing the deleting, as well as a stated reason for the log). Backup first:
Rich (BB code):UPDATE xf_post SET message_state = 'deleted' WHERE message_state = 'visible' AND user_id BETWEEN 2 and 10; INSERT INTO xf_deletion_log (content_type, content_id, delete_date, delete_user_id, delete_username, delete_reason) SELECT 'post', post_id, UNIX_TIMESTAMP(), 1, 'admin', 'manually deleted via query' FROM xf_post WHERE message_state = 'deleted' AND user_id BETWEEN 2 and 10 ON DUPLICATE KEY UPDATE content_id = VALUES(content_id); UPDATE xf_thread SET discussion_state = 'deleted' WHERE discussion_state = 'visible' AND user_id BETWEEN 2 and 10; INSERT INTO xf_deletion_log (content_type, content_id, delete_date, delete_user_id, delete_username, delete_reason) SELECT 'thread', thread_id, UNIX_TIMESTAMP(), 1, 'admin', 'manually deleted via query' FROM xf_thread WHERE discussion_state = 'deleted' AND user_id BETWEEN 2 and 10 ON DUPLICATE KEY UPDATE content_id = VALUES(content_id);
Seeing over 20,000 spam posts across a few forums, I tried this with great hopes. For some reason, it's not working for me. It says MySQL returned an empty result set (i.e. zero rows).
Works for me. Tested it myself, and again just now. Make sure your range of user_ids is correct.
I would also note that you need to rebuild your thread and forum information after this:
Admin CP -> Tools -> Rebuild Caches
Next question would be, is there a query to hard delete all soft deleted threads?
You could do this by using this addon http://xenforo.com/community/resources/sonnb-messages-mass-actions.824/ with carefully attention (Backup before perform deletion).Got it. This query was a lifesaver. Still spent most of my day after what was the worst spam attack I've seen on my forums. Some spammers had over 6,000 posts.
Next question would be, is there a query to hard delete all soft deleted threads?
Ouch.Unfortunately not. Hard deleting is not really possible with simple queries because it involves many joined tables. Hard deletions need to be done using inline moderation, and as of right now that is a one-by-one checkbox kind of proposition.
Hello, please help me, I use this code in the php script, and received error message: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT INTO xf_deletion_log (content_type, content_id, delete_date, delete_user_' at line 6
what there can be a problem? Sorry for my english. thanks!
Exactly the information I wanted !In the admin CP, you can't even see the date people registered !
Apparently you have a syntax error in your queries. Please post the full queries you are using.
We use essential cookies to make this site work, and optional cookies to enhance your experience.