XF 1.5 Deleting the content of a prolific user's posts — MySQL query?

compactabt

Member
Hi everyone. I have a longstanding forum user with 60,000+ posts who would like his contributions to the forum deleted. He'd like to keep his account if possible, but that's not a dealbreaker.

Flagging him as spam doesn't work (it times out without deleting anything), and I've tried the Delete Posts add-on, but that's not doing it either.

I'm wondering if running a MySQL query to 'empty out' all his posts might be the most graceful way of doing this. (Also least destructive, as he's started a few threads in his time.) Something like...

UPDATE xf_post
SET
message =
WHERE user_id = 123

...or similar. Can anyone help me out with the right query — and let me know of any possible problems I might run into?
 

nocte

Well-known member
This query will remove all user posts.
.. but is NOT recommended. Really NOT! You should never delete content form the database via SQL queries, because you risk orphaned data and big technical troubles.

UPDATE xf_post
SET
message =
WHERE user_id = 123
That's a better approach, as it will only change the content of the posts - reactions to that posts will not be orphaned and thread pagination will also not be affected. But it won't change the search index!

FWIW, I would not recommend running any SQL query in that case. Do it at your own risk.
 

Kirby

Well-known member
You should never delete content form the database via SQL queries, because you risk orphaned data and big technical troubles.
Never might be a bit too much though.

I am doing things like this kinda routinely (when preparing imports / merges), but I certainly would't advise this to anybody who doesn't know 110% what he is doing (and can fix possible issues himself without further help).
 

AndyB

Well-known member
Hi everyone. I have a longstanding forum user with 60,000+ posts who would like his contributions to the forum deleted. He'd like to keep his account if possible, but that's not a dealbreaker.

Flagging him as spam doesn't work (it times out without deleting anything), and I've tried the Delete Posts add-on, but that's not doing it either.

I'm wondering if running a MySQL query to 'empty out' all his posts might be the most graceful way of doing this. (Also least destructive, as he's started a few threads in his time.) Something like...

UPDATE xf_post
SET
message =
WHERE user_id = 123

...or similar. Can anyone help me out with the right query — and let me know of any possible problems I might run into?

DO NOT run any query to delete posts.

Use this add-on instead:

https://xenforo.com/community/resources/delete-posts.3102/
 

briansol

Well-known member
From a management perspective, i would never allow this.

the flow of your board will be greatly hindered. 60k posts! never!

I would suggest trying to approach it with the member as --
- anonymize current posts
-- update the userid to some new DSWEAFWEFSEAF account
-- make a select pass and look for things like the user's name, email, etc that may ID them and edit it out.

Then, allow the new account to use the old user name.
 
  • Like
Reactions: Sim

Sim

Well-known member
I agree with @briansol - I do not bulk delete posts under any circumstances. It destroys the discussions that other members have contributed to and is not fair on the community.

In this situation I would offer to rename the user account to depersonalise it, change the email address, deactivate the account, and tell the user to create a new user account if they want to continue posting.

If there is personally identifying information that has been posted by this user that they are concerned about - tell them to report the specific posts (make it their responsibility to locate them) - and then you can assess the posts on a case-by-case basis to determine whether deletion is appropriate.

I've just done exactly this on one of my sites - I had a request to delete all of someone's posts, fortunately they hadn't posted very much so I was able to go through their threads and I found one which was asking for very specific advice about his mother's situation and I deleted that one - but the other threads were just depersonalised by renaming his account.
 
Top