SQL: Removing users threads / posts while not deleting the topics

Marcus

Well-known member
#1 Delete user DELETEDUSERNAME in APC

#2 remove message text from first post and change user name to "guest" from topics created by deleted user

Code:
UPDATE `xf_thread`, xf_post
SET message = ""
AND xf_thread.username = "Gast"
AND xf_post.username = "Gast"
WHERE xf_thread.username = "DELETEDUSERNAME"
AND xf_thread.thread_id = xf_post.thread_id
AND position=0

#3 set posts to deleted in all posts with the exception of first posts that are needed to display the topic. the user name can stay.

Code:
 UPDATE xf_post
SET message_state = "deleted"
WHERE xf_post.username = "DELETEDUSERNAME"
AND position != 0

Is that correct?
 
Back
Top Bottom