MyBB Community Forums

Full Version: [SMF 1.x -> MyBB] Quote BBCodes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello there,

A couple of months ago I converted our forum from SMF 1.x to MyBB. I ran the merge tool and had a couple of problems which have mostly been fixed since.

My remaining problem is with quotes. Basically, simple quotes were converted fine, such as:
[quote]
Blah blah
[/quote]

However, quotes with further arguments -- which were usually generated when clicking the quote button -- were not, so I'm stuck with many posts like this:

[quote author=Member link=topic=1.msg1#msg1 date=1237336287]
Blah blah
[/quote]

This bug report was around and unresolved back then, but it has since been resolved. The question is: how do I fix these quotes now? I had a knowledgeable member of the forum try to help me with some fairly advanced MySQL queries, but they weren't working presumably because his expertise is in MSSQL. As for me, I have no expertise in MySQL and I don't even know where to begin to write PHP code to run through every post & PM on the forum.

Anyway, here is the relevant code from bbcode_parser.php in the fixed version. Would be wonderful if someone could help convert to a working MySQL query or something.

	/**
	* Parses SMF quotes with author, post id and/or dateline.
	*
	* @param string The message to be parsed
	* @param string The information to be parsed
	* @return string The parsed message.
	*/
	function mycode_parse_post_quotes($message, $info)
	{
		$info = trim($info);
		
		preg_match("#author=(.*?)=#i", $info, $match);
		if($match[1])
		{
			$username = $match[1];
		}
		
		/*preg_match("#link=topic=([0-9]+).msg?([0-9]+)\#msg([0-9]+)?#i", $info, $match);
		if($match[1])
		{
			$pid = $match[1];
		}*/
		
		preg_match("#date=?([0-9]+)#i", $info, $match);
		if($match[1])
		{
			$dateline = $match[1];
		}

		return "[quote='{$username}' dateline='{$dateline}']{$message}[/quote]";
	}

Thank you.
Anyone?
I'm sure someone will respond soon, as for me, MySQL is not my friend :/
This is actually a piece of cake. I wrote a quote fixer for a different board import system, I could easily edit it to work for this. Assuming I can still find it that is. I may have deleted it.
Ok, so I found it and edited it to work for your issue. Please back up your db before you run it though. I'm not responsible for anything you screw up with it Wink

To use it just upload it to your MyBB_Root directory and go to www.yourwebaddress.com/MyBB_Root/QuotesFix.php

Note the MyBB_Root may not exist in your url, which would just move the quotes fix over.

Good luck.

[attachment=15772]
You can also just use the custom mycodes in mybb admincp and add this as an option. Best of both worlds imho.
Many thanks, ralgith! I'll give that a go and report back.

Edit: worked beautifully!
You're welcome, and good luck. Smile