Fixed XF-XF Import inline attachment problem


Well-known member
Just done an import from and to same version of XF and have found an issue with inline attachments.

All posts that have an attachment placed inline of the post, the attachment is added as an attachment and not inline leaving a link in the post to the attachment that when clicked displays standard XF error. See attached:


Well-known member
Thanks Mike, on further investigation the description of the issue is simple however the fix may not.

The scenario is importing an existing XF site into a new default XF site, versioning the same, and NOT selecting the "Retain imported content IDs". The importer performs its magic, it converts the attachment ID however it does not perform a string update query on the posts in the Post Table amending the Attachment IDs to their new respective ones.

Although it is noted that you should use the "Retain imported content IDs" in this scenario however I know just with my site, it is a great opportunity to really clean up your site and increasing its performance not just in day to day operations in such instances of smaller values in record IDs but also in Administrative activities where batch loads occur based on records between two anchoring values. In my instance I have a News Reader based on RSS feeds. Getting many records every hour to a point where every now and then I clean out thousands of threads and posts as the News Items are so old and so many. The same goes for users now that my site has been running for so many years now I have users that haven't logged on for over 5 years. I clean them out to provide a greater range of available usernames for new users however this also leaves great gaps in User IDs. I have 9,302 users now however every time a User ID is referenced it is referencing an extra digit as the User Table is up to 15,000...I know all small minor things but from little things big things grow like an extra second in latency.

Anyway, hope this helps explaining the scenario that has caused the issue and the benefit of if it was fixed


XenForo developer
Staff member
The values of IDs won't affect performance, but as you may have noted, maintaining IDs should prevent the issue. Any fix for this issue wouldn't be available until the next release, though we might be able to provide a patched file if it's urgent (once the necessary fix is identified).

Just as a general point, we would not recommend using an importer to "clean" an installation as there are many things that will not be maintained. Changing IDs to do clean up is a big deal and, in this case, will likely break all existing links to individual threads, for example. We would always recommend cleaning up an installation directly.