XF 1.5 Visitor messages from vBulletin 3.8 converted to literal HTML

Rasmus Vind

Well-known member
Have a look at the attached pictures. I have imported my vBulletin into XenForo and all the color tags are converted to literal HTML. What's up with that? Shouldn't we just strip the BB Code or keep it as is and not render it?
 

Attachments

  • Skærmbillede 2016-05-30 09.13.00.webp
    Skærmbillede 2016-05-30 09.13.00.webp
    113.6 KB · Views: 11
  • Skærmbillede 2016-05-30 09.13.01.webp
    Skærmbillede 2016-05-30 09.13.01.webp
    219 KB · Views: 10
Looks to me like your messages actually had HTML in them (allowed and rendered). That's what was actually in the message.

XenForo doesn't support formatting in profile posts (HTML or BB code), so we just import them as is. I could really only recommend removing this code manually at this point.
 
I think you're wrong. Take a look at this code from XenForo_Importer_vBulletin:
PHP:
        $formatter = XenForo_BbCode_Formatter_Base::create('XenForo_BbCode_Formatter_Text');
        $parser = XenForo_BbCode_Parser::create($formatter);

        foreach ($vms AS $vm)
        {
            // [...]
            $import = array(
                'profile_user_id' => $profileUserId,
                'user_id' => $postUserId,
                'username' => $this->_convertToUtf8($vm['postusername'], true),
                'post_date' => $vm['dateline'],
                'message' => $parser->render($this->_convertToUtf8($vm['pagetext'])),
                'ip' => XenForo_Helper_Ip::convertIpBinaryToString($vm['ipaddress'])
            );
            // [...]
        }

You actually use a BB Code parser and render the pagetext.
 
I stand corrected on the importing as is part, but the rest is correct. We're rendering the BB code down to a plain text representation. It looks like yours was done in raw HTML.
 
Nope. It's BB code alright.

How does it work by making it plain text? I wrote my own [color] tag because XenForo does not support [color=ff00ff] (without the # mark) which vBulletin does. Perhaps mine is rendering when it shouldn't.
 

Attachments

  • Skærmbillede 2016-05-30 11.09.16.webp
    Skærmbillede 2016-05-30 11.09.16.webp
    141.4 KB · Views: 11
That is very likely it. Have you defined a text replacement for your BB code? (In the advanced options.) It should just be removed out the box, but I'd have to test that if you've left it empty.
 
Actually, just to confirm/clarify: if your custom BB code is using a callback, you need to choose what to do based on the type of BB code formatter in use (HTML, WYSIWYG, text, etc). The text replacement option I mentioned only applies if you're using a straight HTML replacmement.
 
Okay. I am looking into the scope of all this. Oh boy what a mess. I am not sure I think the way [plain][code] and [php] is treated is optimal. Shouldn't they just evaluate to [CODE] and [PHP]? I will need to go through all my codes and make sure they are handled well in plain text mode. Is there a good way to test this?
 
Shouldn't they just evaluate to [CODE] and [PHP]?
Removing the code entered? That doesn't really make sense to me. This is parsing to a plain text representation and the code itself would fit as that.

Is there a good way to test this?
Aside from creating a test script for your needs, the text parser is used to create textual versions of posts/conversation messages for emails (the text version rather than the HTML version). It is also used for the thread quick preview.
 
Right. I am just thinking from the perspective of imported visitor messages from vBulletin. They display no line breaks so imported ones that contain code will look all mangled. This is why I think it would probably look better if it was just [CODE] instead of inline code with no line breaks. This is just 2786 out of the total 614222 imported VMs though of which 154 was made in the past 6 months.
 
Back
Top Bottom