1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Soft delete all moderated posts (queries)

Useful for clearing out a backlog of moderated posts when you don't want to permanently delete them.

  1. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Jake Bunce submitted a new resource:

    Soft delete all moderated posts (queries) (version 1.x) - Useful for clearing out a backlog of moderated posts when you don't want to permanently delete them.

    Read more about this resource...
     
  2. Ramses

    Ramses Member

    Any query to hard delete all soft deleted posts? Thanks.
    Edit, have deleted now all direct in phpmyadmin.
     
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    No. Hard deletes involves many tables, as well as attachments in the file system. There is no easy way to completely hard delete with queries.
     
  4. snoopy5

    snoopy5 Well-Known Member

    I just used successfully this code for softdeleting over 400 posts after a vbimport.

    What happens now with these softdeletions, if I can not hard-delete them? Is there a performance downside? Is there a way to hard delete them as admin in the ACP of XF?
     
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    There is no good way to hard delete because it involves many joined records. Just leave them. There is no performance downside.
     
  6. Ryan Hickman

    Ryan Hickman Member

    This is a great tip but it lacks support for profile posts.

    Code:
    INSERT INTO xf_deletion_log (content_type, content_id, delete_date, delete_user_id, delete_username, delete_reason)
        SELECT content_type, content_id, UNIX_TIMESTAMP(), 1, 'admin', 'manually moved from moderation to soft delete'
        FROM xf_moderation_queue AS mq
        WHERE mq.content_type = 'profile_post';
    
    DELETE
    FROM xf_moderation_queue
    WHERE content_type = 'profile_post';
    
    UPDATE xf_profile_post
    SET message_state = 'deleted'
    WHERE message_state = 'moderated';
    
     
    Jake Bunce likes this.

Share This Page