MyBB Community Forums

Full Version: Post parser is not parsing anything!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
$parser = new postParser;
			$parser_options = array(
				"allow_html" => "0",
				"allow_mycode" => "1",
				"allow_smilies" => "1",
				"allow_imgcode" => "1",
				"filter_badwords" => "1"
			);
	
			$message = $parser->parse_message($post['message'],$parser_options);
			
			//$message = $post['message'];

			eval("\$threadhead = \"".$message."\";");

This code only outputs the post when it is not parsed. Why?

Note I am using the MyBB 1.4 parser
Bump.
Is that in a plugin? Please post full function. With the 1.6.5 changes you'll likely just need to make a couple small adjustments for it to work.
(2011-12-08, 11:38 PM)labrocca Wrote: [ -> ]Is that in a plugin? Please post full function. With the 1.6.5 changes you'll likely just need to make a couple small adjustments for it to work.

Yes a plugin. It is written for 1.4 so I don't think the 1.6.5 changes will change it.

function thread_header() {
	global $mybb, $db, $templates, $theme, $lang, $threadhead;
	
	require_once MYBB_ROOT."inc/functions_post.php";
	require_once MYBB_ROOT."inc/functions_indicators.php";
	require_once MYBB_ROOT."inc/class_parser.php";

	// If setting has been enabled, attempt to display thread
	if ($mybb->settings['threadenable'] == '1') {
		// If thread ID setting is not empty, get it from the database
		if ($mybb->settings['threadtoshow']) {
			$query = $db->query("
				SELECT p.*
				FROM ".TABLE_PREFIX."posts p
				WHERE tid='".$mybb->settings['threadtoshow']."'
			");
			
			$post = $db->fetch_array($query);
			
			//$message = $parser->parse_message($post['message'],$parser_options);
			
			$parser = new postParser;
			$parser_options = array(
				"allow_html" => "1",
				"allow_mycode" => "1",
				"allow_smilies" => "1",
				"allow_imgcode" => "1",
				"filter_badwords" => "1"
			);
	
			$message = $parser->parse_message($post['message'],$parser_options);
			
			//$message = $post['message'];

			eval("\$threadhead = \"".$message."\";");
		}
	}
}
That looks right. Is it not parsing anything? Mycode or html?


This looks like you're also making some announcement type plugin. Why not just use announcements?
It's not parsing MyCode and I haven't tried HTML. I'll test it out again later today.

I want to allow users to to edit the announcement without accessing the Admin CP. I also want to give specific users the ability to edit announcements.