Attachments on custom addon are not parsed

Jean-Baptiste

Well-known member
Hello,

I made a custom addon, where the user can upload attachements using the attachement handler class.

Once uploaded, I'm linking the temp hash attachement to it's content, and the image as an example, is correctly uploaded into the attachement folder.

The problem is that when I try to parse the attachement, I got the following result:
03cf8466ef7d0131a6a738359cb424b0.webp

Code:
[ATTACH]12[/ATTACH]
[ATTACH=full]12[/ATTACH]
[ATTACH=full]13[/ATTACH]
[ATTACH=full]4[/ATTACH]

When I use the same BBCode to parse image attachements into a thread, it's not working, so the problem is from my addon, there is something missing with my attachment handler.
When I upload a thread using a post's 'upload a file' button, it's working.

Do you have any ideas ?

Kind regards.
 
I'm totally stuck. Why aren't my images attachments showing up?

The content type was made, I re-builded that cache.
The attachment handler class is created.
I'm linking the content to the attachement when I add/edit it.
The images in the data folder looks fine, and are CHMODED 777.

I thought I needed to play with the bbcode parser, so I've done this in my view, but that didn't resolved the problem:
PHP:
        $bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
   
        $bbCodeOptions = array(
                'states' => array(
                        'viewAttachments' => true
                )
        );
        $this->_params['a']['content'] = new XenForo_BbCode_TextWrapper($this->_params['a']['content'], $bbCodeParser, $bbCodeOptions);
 
Last edited:
I think that's standard behavior, at least when I try to re-use an attachment with the attach bbcode it only creates a link, if not in the same post with the attachment.

@AndyB described a work-around here RE-USE of attachment files

but then, for me, the standard attachment behavior in the same post with the attachment quit working

so my next move will be to try making a new bbcode that links directly to /attachments/#/ , where # is the attachement ID, I think that'll work for me....
 
I think that's standard behavior, at least when I try to re-use an attachment with the attach bbcode it only creates a link, if not in the same post with the attachment.

@AndyB described a work-around here RE-USE of attachment files

but then, for me, the standard attachment behavior in the same post with the attachment quit working

so my next move will be to try making a new bbcode that links directly to /attachments/#/ , where # is the attachement ID, I think that'll work for me....

Yes that's a good alternative, but it's won't resolve the problem...

The XenForo XenResource manager is correctly doing that. I think the solution is to fetch attachments onto the content, there are some examples in the xenforo core of conversations and posts using the method:
Code:
getAndMergeAttachmentsIntoXXXXXXXXXXX

But I have problems to implement it, since my content in a single array.
 
@allewreK I have something that I think you could help me with if you're interested. It falls into this category of mod. I already have a mod that does most of the work but I need a handler to be able to put the iframe wherever in the post I want. Please PM me if you're interested. Thanks.
 
Top Bottom