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

Deleting reported items

Discussion in 'XenForo Development Discussions' started by Onimua, Apr 4, 2011.

  1. Onimua

    Onimua Well-Known Member

    There doesn't seem to be a way to remove reported items from the front end, but there also doesn't seem to be a quick way to delete items via code either (similar to XenForo_Model_DeletionLog::removeDeletionLog and XenForo_Model_ModerationQueue::deleteFromModerationQueue), is that the case?

    Essentially I'm looking to deleted information from xf_report and xf_report_comment if the content is no longer available (hard-deleted from the database), unless there's a specific reason it's not recommended. I could do it via query (fetch report_id from xf_report, then delete records from xf_report_comment using the id) but I wanted to be sure I didn't miss an existing method first. If I do, do I need to be aware of any caches that should be rebuilt after?
     
  2. Onimua

    Onimua Well-Known Member

    Upon closer inspection, it seems that if you report a post or thread and hard-delete it, the report isn't removed either. Is this intentional or an oversight? :confused:
     
  3. Onimua

    Onimua Well-Known Member

    Any info on this from anyone? :unsure:
     
  4. Mike

    Mike XenForo Developer Staff Member

    It's intentional. It'd be rather pointless to remove the report that triggered the removal of the content.
     
  5. ragtek

    ragtek Guest

    I have to disagree.
    A short summery in the deletion log would be IMHO much better instead of having still the whole reportentry in the dabase.. (that's also something i can't understand. If the user softdeletes an thread/post, he can post a reason, but if he harddeletes it, there's no reason.)

    my 0.02$
     
  6. D.O.A.

    D.O.A. Well-Known Member

    *bump*

    Does anyone have a easy method of deleting the old reported posts? we don't need a permanent record/capture of the indecent content we've dealt with and perma-deleted. We also make great use of our report function (well.. our members do) and having page after page of "dealt with" reports from months ago seems totally unnecessary.

    Add a delete button please, for some of us the need to have a forever's worth of report history is not that wanted, the post is gone, the report is now a useless entry/reminder of what once was :)
     
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Run these queries to prune all reports (and their comments) older than 30 days:

    Code:
    DELETE
    FROM xf_report
    WHERE last_modified_date < UNIX_TIMESTAMP() - 30*86400;
    
    DELETE rc.*
    FROM xf_report_comment AS rc
    LEFT JOIN xf_report AS r ON (r.report_id = rc.report_id)
    WHERE r.report_id IS NULL;
    
     
    RoldanLT, D.O.A. and Jeremy like this.
  8. Reterg

    Reterg New Member

    When viewing a report, there should be a button on the side bar titled "Claim and handle report"
    Click it, then select it as resolved.
    That will remove it from the list of reported items.
     
  9. RoldanLT

    RoldanLT Well-Known Member

    What about deleting all reports older than 1 day? or 2 days?
     
  10. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Change the number of days:

    Code:
    DELETE
    FROM xf_report
    WHERE last_modified_date < UNIX_TIMESTAMP() - 30*86400;
    
    DELETE rc.*
    FROM xf_report_comment AS rc
    LEFT JOIN xf_report AS r ON (r.report_id = rc.report_id)
    WHERE r.report_id IS NULL;
    
     
    RoldanLT likes this.
  11. TheLaw

    TheLaw Well-Known Member

    Is there an easier way to manage this issue? I see the thread is 2 years old. The problem we're having is that the report shows a number associated with it and doesn't indicate whether it's a new report or current. I don't think it's an addon. For example, same as above. User requests we delete a topic. Topic is deleted but the report still remains along with a number "1" in the admin bar. I don't think it's an addon and pretty sure it's stock XF as described above.
     
  12. TheLaw

    TheLaw Well-Known Member

    Ahhhhh..... I see it now. It's in the sidebar. UI can sometimes be a challenge, such as in this case.
     
  13. Grizzly Adam

    Grizzly Adam Active Member

    Is their an equivelant in mysql?
     
  14. Martok

    Martok Well-Known Member

    Those are MySQL queries.
     
  15. Grizzly Adam

    Grizzly Adam Active Member

    I'm just getting error what I try. Do I run them one line at a time or what?
     
  16. Grizzly Adam

    Grizzly Adam Active Member

    Code:
    Failed to execute SQL : SQL DELETE FROM xf_report WHERE last_modified_date < UNIX_TIMESTAMP() - 30*86400; DELETE rc.* FROM xf_report_comment AS rc LEFT JOIN xf_report AS r ON (r.report_id = rc.report_id) WHERE r.report_id IS NULL; failed : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELETE rc.* FROM xf_report_comment AS rc LEFT JOIN xf_report AS r ON (r.report_i' at line 1
     
  17. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    The semicolons should allow running them both together. You can also try running the two queries separately.

    How are you running the queries? phpmyadmin always works.
     
  18. Grizzly Adam

    Grizzly Adam Active Member

    Execute command function through MySQL Database Server on webmin.
     

Share This Page