XF 1.3 Why can't [ATTACH] bbcode be used between different posts?


Well-known member
I'm curious as to why we can't use the "ATTACH" bbcode to reference attachments from other posts. For example, here's what's displayed when I reference an attachment I uploaded to a post in the test forum (notice the "View attachment" link):
View attachment 80344

I can still display the image using the IMG tag, though:


This seems like a design decision, though I'm not sure why it works like this and it's been confusing and unexpected to my users.

I noticed some plugins can work their way around this - for example, the "Image Attachment Optimization & CDN Support" plugin by @Dinh Thanh allows attachments to be cross-referenced.


XenForo developer
Staff member
The attachment information is not fetched because it's not part of the post, so therefore it can't be displayed. Attachments to a post have known permissions; other arbitrary attachments don't and thus can't necessarily be displayed.

You'll note that embedding it doesn't actually work here because guests can't see the attachment and thus the image proxy can't load it (if relevant). If it does work for you, look at it as a guest.

The key comment with that add-on:
Force image attachments work with Guest permission (Guests can view full image attachments without login logged in permission)
It effectively disables image attachment permissions. This could leak attachments from private forums, for example.