XF 1.5 Remove all duplicate posts


Hello all,

I have an old issue in my forum, which is that some of old posts are doubled. (content, user and date are all the same in both posts)
I will not go thru the unnecessary detials of how this happened.
But I need to know if there is a way to hide them or delete them either by a script or mysql statements.

It would be really great if there is a solution!

Thank you,


The "how" may be relevant, but these posts would need to be removed manually via the UI.


The threads affected have the same pattern. The first post in the thread (the thread itself) must be exactly the same as the second one. Otherwise it is not affected.

Depending on this info, can we build a mysql statement that get the affected threads? If yes, then I think then I can find a way to delete all even numbered posts.

About the "how", honestly I do not know. Wrong restoration of a backup by old technical support guy :).


XenForo developer
Staff member
You may be able to write a query that joins the xf_post table to itself based on the thread_id and the position (position + 1) to detect whether the content of the messages is identical. This would probably involve some testing and tweaking to get right though.