Resource icon

Add preview text for first post in thread list

RichardKYA

Well-known member
#21
I might have solved the problem with sticky threads, mind you, I have no idea what I am doing ;)
I replaced the original change by @Jake Bunce in View.php with the following:
PHP:
        // RENDER FIRST POSTS
        $previewLength = XenForo_Application::get('options')->discussionPreviewLength;

        foreach ($this->_params['threads'] AS &$thread)
        {
            if ($previewLength && !empty($thread['message']))
            {
                $formatter = XenForo_BbCode_Formatter_Base::create('XenForo_BbCode_Formatter_Text');
                $parser = XenForo_BbCode_Parser::create($formatter);

                $thread['messageParsed'] = $parser->render($thread['message']);
            }
        }
        foreach ($this->_params['stickyThreads'] AS &$thread)
        {
            if ($previewLength && !empty($thread['message']))
            {
                $formatter = XenForo_BbCode_Formatter_Base::create('XenForo_BbCode_Formatter_Text');
                $parser = XenForo_BbCode_Parser::create($formatter);

                $thread['messageParsed'] = $parser->render($thread['message']);
            }
        }
Think it works but maybe it could be done in another way?
Does this work OK?
 
Top