XF 1.4 Importing HTML Post Content as bbcode?

SIneDave

Member
Hi All,

Our big board is full of posts with HTML content, almost all of which are posted by administrators. Our current platform (IPB) allows HTML, so this is just stored raw in the database.

Slavik has done a tremendous job on a test import for us so we can spot issues, and we have found HTML being stripped to be a huge one. I'm looking for a solution that will allow us to convert to XF and preserve formatting. Ideally, i'd just like the same raw HTML to render in XF, but i'd also be open to a script/regex that replaces HTML with standard bbcodes.

Does anyone have any ideas/solutions. I can't be the first person to run up against this, but my searches so far have been fruitless.

Many thanks.
 
XenForo has this function to perform the conversion:

XenForo_Html_Renderer_BbCode::renderFromHtml

I am attaching a script I made once to apply this, but it's not turnkey and requires some code ability as well as controlled testing for your specific forum.

Also, if memory serves, this script has a behavior where unrecognized HTML tags are stripped so you need to be very careful. Consult with library/XenForo/Html/Renderer/BbCode.php to see what tags are handled.
 

Attachments

Back
Top Bottom