view bbCodeParser : prevent urls getting passed


Well-known member
I have my view set up to include the following
    public function renderHtml()
        $bbCodeParser = new XenForo_BbCode_Parser(
                XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this))
        $bbCodeOptions = array(
            'states' => array(
                'viewAttachments' => true
        $messageArray = array('message' => $this->_params['content']);
        $this->_params['content']= XenForo_ViewPublic_Helper_Message::getBbCodeWrapper(
                $messageArray, $bbCodeParser, $bbCodeOptions

This parses any bbcode, and renders attachments, but there is one thing I do not want to do. I do not want the urls to get passed, I want them to remain as:
[]test[/url] (or even remove the link and just leave "test")
(The reason for this, is that the data I am rendering is already within a link)
I've been searching through the core parser classes, and can't find an option to do this.

Is it possible, or should I just strip out these bbulrs before passing?

Jake Bunce

XenForo moderator
Staff member
Maybe set a flag in the 'states' and extend XenForo_BbCode_Formatter_Base::renderTagUrl to check that flag. You can see a code example in the default function where it checks $rendererStates['noFollowDefault'] which is a state set in XenForo_ViewPublic_Helper_Message.