MyBB Community Forums
How to remove all posts / threads from specific user in specific forum(s)? - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Community Archive (https://community.mybb.com/forum-106.html)
+--- Forum: Archived Forums (https://community.mybb.com/forum-143.html)
+---- Forum: Archived Development and Support (https://community.mybb.com/forum-155.html)
+----- Forum: MyBB 1.6 (https://community.mybb.com/forum-138.html)
+------ Forum: 1.6 General Support (https://community.mybb.com/forum-127.html)
+------ Thread: How to remove all posts / threads from specific user in specific forum(s)? (/thread-157844.html)



How to remove all posts / threads from specific user in specific forum(s)? - Mitko - 08-21-2014

As title says, I want to do it via the MySQL, because manually, it would take a lot of time scrolling through pages etc (there are like 10k posts)

Thanks in advance.


RE: How to remove all posts / threads from specific user in specific forum(s)? - Matt - 08-21-2014

Try these queries.

DELETE mybb_posts FROM mybb_posts JOIN mybb_threads ON mybb_threads.tid = mybb_posts.tid WHERE (mybb_posts.uid = X OR mybb_threads.uid = X) AND mybb_threads.fid IN(1,2,3);
DELETE FROM mybb_threads WHERE uid = X;

The first one will delete all posts by that user, and all posts by any other user in any threads the user created, in the specified forums. The second one will delete any threads the user created in the specified forums.

Change X to the ID of the user, and the 1,2,3 to the IDs of the forums you want this to affect.

Then, run the recount and rebuild tools in the Admin CP.

However, if you're dealing with that many posts, I highly recommend you install a test forum, backup your forum's database, and import it to the test forum's database, and run this on there first, just to check it works. At the very least, close your forum and backup your database before doing it.