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

Allow parsing of BB Code in Poll Responses

Discussion in 'XenForo Suggestions' started by Chris D, Mar 21, 2013.

  1. Chris D

    Chris D XenForo Developer Staff Member

    With an add-on it is actually quite simple to parse poll options with BB Code.

    First you extend XenForo_ViewPublic_Thread_View:

        public function renderHtml()
    $parent parent::renderHtml();
            if (!empty(
    $bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
                foreach (
    $this->_params['poll']['responses'] AS &$response)
    $response['response'] = new XenForo_BbCode_TextWrapper($response['response'], $bbCodeParser);
    And then similarly extend XenForo_ViewPublic_Thread_PollResults

    After making a small template edit in poll_block_result and poll_block_vote (changing {$response.response} to {xen:raw $response.response}) the end result is as follows:


    I would like to suggest this be considered for the core. As well as allowing us to add more context to polls and poll responses, it is also a feature that is missed when moving from other forum software.

    Also worth considering is the VARCHAR length of the xf_poll_response.response field. The length is 100 and although in the context of plain text that is a reasonable length, with BB Code this should probably get larger (preferably to match the same limits provided by PHPBB and vBulletin to aid in imports).
  2. Alluidh

    Alluidh Well-Known Member

    @Chris Deeming
    I'm not able to find "PollResults"
    Did this change in the last versions of XenForo?
    And - is it possible to create an add-on for this needful feature?

    Thanks for your support
  3. egerci

    egerci Member

    I wonder that do you suggest this after being member of xenforo developer team ? I have moved my forum from Vbulletin and many of my polls have BBCODE. I am looking for solution for this.

    Or @Chris D would you please tell us how to make these change detailed ?
  4. whynot

    whynot Well-Known Member

    He wasn't a member of the XenForo developer team in that time: Mar 21, 2013
  5. egerci

    egerci Member


Share This Page