MyBB Community Forums

Full Version: What are the post filters?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
MyBB,
What do I need to add for include() or require() so that the messages will be filtered?
To be blatant, I was trying to make a page where it holds the latest messages from two forums. It worked well at first... but then I noticed that things like [b],[u], or [url] didn't work out - it wasn't changed to <b> and such. To add to it, in IE the text gets all jumbled together.

Regards, Ginji.
You need to use the MyBB post parser.

./inc/class_parser.php
MyBB,
That's a long code Toungue Can you shortly tell me what variable is used for the parser to parse the message?

Regards, Ginji.
Ex.
				$parser_options = array(
					'allow_html' => "no",
					'filter_badwords' => "yes",
					'allow_mycode' => "yes",
					'allow_smilies' => "no",
					'allow_imgcode' => "no"
				);		
				$message = $parser->parse_message($message, $parser_options);
Initialize the parser with:

$parser = new postParser;

Then use this to set the options:

			// Set up the parser options.
			$parser_options = array(
				"allow_html" => $forum['allowhtml'],
				"allow_mycode" => $forum['allowmycode'],
				"allow_smilies" => $forum['allowsmilies'],
				"allow_imgcode" => $forum['allowimgcode']
			);

This is assuming you are using $forum as the array for the forum information you grab from the database, if you don't grab the forum information then use LeX-'s code.

Then you need to use this to parse the messages properly.

$option = $parser->parse_message($THE_VARIABLE_THAT_PRINTS_THE_POST, $parser_options);

And that should work.

By the way, I'm going to move this to Modifications Discussion, since it is not (technically) a problem with MyBB itself. Smile