XF 1.1 A lot of "code" is showing after conversion


I've managed to convert 714K posts from SMF to xenForo but it has not been without issues. One of the issues I am currently experiencing is that a lot of posts are showing "code" instead of outputting the desired result. I have attached an annotated screenshot for reference (NOTE: There may be some foul language in the topic, in case anyone is sensitive to that)

Is there a way to fix this or am I out of luck?

Any help would be appreciated.


  • atw_page_display.webp
    32.6 KB · Views: 68
Run this query to fix the <br /> tags:

UPDATE xf_post
SET message = REPLACE(message, '<br />', '\n');

For the single quote entities:

UPDATE xf_post
SET message = REPLACE(message, '&#039;', '\'');

For the double quote entities:

UPDATE xf_post
SET message = REPLACE(message, '&quot;', '"');

The quote and size tags require you to install this addon:


For the size tags use this to simply remove the tag:

Quick Find: [size

Regular expression: #\[size=([\d]+)pt\]([^\[]+)\[/size\]#siU

Replacement String: \2

Screen shot 2011-12-05 at 6.34.14 PM.webp

For the quote tags use this:

Quick Find: [quote

Regular expression: #\[quote author=([a-z0-9_ \-]+) link=([^\]]+)\]([^\[]+)\[/quote\]#siU

Replacement String: [quote="\1"]\3[/quote]

Screen shot 2011-12-05 at 6.45.55 PM.webp
Jake, first I want to thank you for posting those suggestions. Second, I'm really scratching my head over here. I followed each step of your post and I'm not seeing the results. When I run the queries, mySQL tells me that "0 rows affected." I also spent a ton of time running the Post Content Replacement Tool, but I don't see the results in any of my posts. Any idea what might be going on?
I tested all of those queries and regexes by recreating your posts on my forum. It should work.

But I see now that some of that stuff is in signatures. Here are queries for the signatures:

UPDATE xf_user_profile
SET signature = REPLACE(signature, '<br />', '\n');

UPDATE xf_user_profile
SET signature = REPLACE(signature, '&#039;', '\'');

UPDATE xf_user_profile
SET signature = REPLACE(signature, '&quot;', '"');

But Kier's addon only does posts, not signatures. The addon would have to be modified to get the BB codes in signatures.
Thank you! I applied those queries and saw the results in my original thread. It could be that I'm not seeing the Post Content Replace Tool changes because I wasn't looking at a thread where it would have been an issue?

What about something like the image below?

Hmm, nested quotes...

Try this:

Quick Find: [quote

Regular expression: #\[quote author=([a-z0-9_ \-]+) link=([^\]]+)\](.+)\[/quote\]#siU

Replacement String: [quote="\1"]\3[/quote]

This fudges the matching a bit but it should yield the correct result. You might find that you need to Save Changes on this replacement multiple times. It will keep matching additional levels of nested quotes each time you run it. Backup first to be safe.
I was able to get this down to 36,058 posts, but now I keep getting "The connection was reset" in my browser. I took a shot in the dark and added

ini_set('memory_limit', '-1');
ini_set('max_execution_time', 0);

to my config.php but it has not helped at all. Any ideas?
Try using this to narrow it down:

Quick Find: [quote author

still scratching my head. now i can't even get my results to show up. a few seconds after clicking "Proceed" i get this:


if i switch the Quick Find back to [quote then i get "Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 51 bytes) in C:\xampp\htdocs\ocommunity\library\Zend\Db\Statement\Mysqli.php on line 304"

I changed my php.ini so that the memory_limit is 512M and the max_execution time is 180.

Any idea what is going on?
Check your phpinfo to make sure the new memory_limit is working:


There are also other ways to increase the memory_limit. See this post.

You might also have to edit the library/XenForo/Application.php file (regarding this thread):

		@ini_set('memory_limit', 128 * 1024 * 1024);
OK, i set the memory_limit to -1 and it took effect, and I also edited the Application.php so it said

@ini_set('memory_limit', 1024 * 1024 * 1024);

and it still gives me the "Connection was reset" after a few seconds. Should I lose hope?
That's a javascript timeout. You apparently resolved the previous limit and exposed a new one. Read from this post to the end:


In short, edit this file:


Search for "3E4". Increase the value. 3E4 is 30000 ms (or 30 seconds).

not sure what you mean. when i search for "3E4" in xenforo.js, i get this:


how do i know what 3E4 should be replaced with? my math is terrible.

also, any idea why my board went to crap? how did it get so screwed up that i can't even post anymore?

BTW, you should keep a big PayPal link in your signature. :notworthy: ;)
Top Bottom