MyBB Community Forums

Full Version: How to delete a users posts, but not threads
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

I need to remove a users posts from my forum, but I don't want to remove any threads they are the author of, as these have taken a life of their own and by pruning in the admin section it would remove everything?

Happy to do this through SQL as well if need be.

Thanks
Depending on how many posts are involved you could edit each one and replace with.

Content Removed

Don't forget to check any posts that have been quoted by another user, and to change the username if you think it would be best.
Thanks for the response. It's too many to edit manually unfortunately.
I was hoping there was something within MYBB or an SQL command that could help me out.
In your database: 
UPDATE mybb_posts set message="content removed" where uid=9999

Replace 9999 with the user ID of the user whose posts you want to remove.
handle with care
(2018-09-04, 12:26 PM)sarisisop Wrote: [ -> ]Depending on how many posts are involved you could edit each one and replace with.

Content Removed

Don't forget to check any posts that have been quoted by another user, and to change the username if you think it would be best.

You don't need to do this, MyBB already has functionality for this. In ACP simply set permissions on the group so that they can view deletion notices. Then go edit the language define {$deleted_message} in postbit_deleted template if necessary to show something custom.

Anyway the OP has an unusual request - will require some skillful SQL editing...
(2018-09-04, 04:38 PM)linguist Wrote: [ -> ]In your database: 
UPDATE mybb_posts set message="content removed" where uid=9999

Replace 9999 with the user ID of the user whose posts you want to remove.
handle with care

would this also replace the original thread content as well? or are threads and posts stored differently in the database?
the first post in a thread is a post too Wink
(2018-09-05, 12:54 PM)dhod Wrote: [ -> ]
(2018-09-04, 04:38 PM)linguist Wrote: [ -> ]In your database: 
UPDATE mybb_posts set message="content removed" where uid=9999

Replace 9999 with the user ID of the user whose posts you want to remove.
handle with care

would this also replace the original thread content as well? 

yes.
Three steps, then: 

First
UPDATE mybb_threads set uid="99999999" where uid=9999;
Use some number that is unique and high enough; this changes the UID for the first post of a thread only.

Second
UPDATE mybb_posts set message="content removed" where uid=9999;
This now only affects those posts of user 9999 that are not first posts of a thread. 

Third:
UPDATE mybb_threads set uid="9999" where uid=99999999;
revert the temporary "reassignment" of firt posts. 

et voila: all posts but the firsts of threads by our user 9999 are cleaned out.