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

Attachments on custom addon are not parsed

Discussion in 'XenForo Development Discussions' started by allewreK, Aug 28, 2013.

  1. allewreK

    allewreK Active Member


    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:

    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.
  2. allewreK

    allewreK Active Member

    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:
            $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: Aug 28, 2013
  3. allewreK

    allewreK Active Member

    @Mike, any ideas ? I'm working on that problem for like 10 hours, it's making me crazy.
  4. SignTorch

    SignTorch Active Member

    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....
  5. allewreK

    allewreK Active Member

    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:
    But I have problems to implement it, since my content in a single array.
  6. allewreK

    allewreK Active Member

    I got it working ! You'll have to fetch the attachments to your content.
  7. russoroni

    russoroni Active Member

    @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.

Share This Page