XF 1.5 Delete Post by Guest ?

HappyWorld

Well-known member
I have some members which were deleted, before removing all of their contents (posts & conversations).

How to delete post by guest?
Do i need to do this query?
Code:
DELETE FROM xf_post WHERE user_id = 0;
SELECT * FROM `xf_thread` WHERE `user_id` = 0;

Or is there any better method? :confused:

UPDATE :
After reading this
https://xenforo.com/community/threads/delete-all-posts-by-guests.56518/

I notice that i should create new user, and assign all guest's content to this new user using this query (XF 1.5.14).

Assuming new user ID is 794202 :
Code:
UPDATE `xf_post` SET `user_id` = 794202 WHERE `user_id` = 0;
UPDATE `xf_deletion_log` SET `delete_user_id` = 794202 WHERE `delete_user_id` = 0;
UPDATE `xf_draft` SET `user_id` = 794202 WHERE `user_id` = 0;
UPDATE `xf_edit_history` SET `edit_user_id` = 794202 WHERE `edit_user_id` = 0;
UPDATE `xf_ip` SET `user_id` = 794202 WHERE `user_id` = 0;

/* Thread */
UPDATE `xf_thread` SET `user_id` = 794202 WHERE `user_id` = 0;
UPDATE `xf_thread_watch` SET `user_id` = 794202 WHERE `user_id` = 0;

/* Poll */
UPDATE `xf_poll_vote` SET `user_id` = 794202 WHERE `user_id` = 0;

/* Content like */
UPDATE `xf_liked_content` SET `content_user_id` = 794202 WHERE `content_user_id` = 0;
UPDATE `xf_liked_content` SET `like_user_id` = 794202 WHERE `like_user_id` = 0;

/* Profile post */
UPDATE `xf_profile_post` SET `profile_user_id` = 794202 WHERE `profile_user_id` = 0;
UPDATE `xf_profile_post` SET `user_id` = 794202 WHERE `user_id` = 0;
UPDATE `xf_profile_post_comment` SET `user_id` = 794202 WHERE `user_id` = 0;

/* Conversation */
UPDATE `xf_conversation_master` SET `user_id` = 794202 WHERE `user_id` = 0;
UPDATE `xf_conversation_message` SET `user_id` = 794202 WHERE `user_id` = 0;
UPDATE `xf_conversation_recipient` SET `user_id` = 794202 WHERE `user_id` = 0;
UPDATE `xf_conversation_user` SET `owner_user_id` = 794202 WHERE `owner_user_id` = 0;

/* User Alert */
UPDATE `xf_user_alert` SET `user_id` = 794202 WHERE `user_id` = 0;
UPDATE `xf_user_alert_optout` SET `user_id` = 794202 WHERE `user_id` = 0;

/* Dismissed Notice */
UPDATE `xf_notice_dismissed` SET `user_id` = 794202 WHERE `user_id` = 0;

Then rename the user 794202 to something else from admin panel to trigger data update on post, conversation, etc.
 
Last edited:
I've removed a troublesome user from the system. I noticed all his posts changed to "Guest." I've been painstakingly deleting them all. Then I will look in certain threads where these posts were deleted, and they've reappeared. Then I need to delete them again. I am choosing "Permanently Delete" each time. Does XF do some sort of backup perhaps, hence why these deleted posts are reappearing?
 
Back
Top Bottom