MyBB Community Forums

Full Version: Quoted messages filtering
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello.

I'm writing plugin that adds several tags to myCode.

One of this tags should allow leave moderator notes in user's posts, so that only another moderators could see it.

For now this tags are processed correct on message displaying - only moderators can see it.
But when any user replys such messge with "Reply" button on post, or with multiquoting from quick reply form or common message form I cannot find hot to truncate this tags and text inside.

for example message is:
simple text
[moder]moderator's note[/moder]

What hooks should I use for filtering quoted texts?

Thanks.
For the normal Reply, generally something like this:
$plugins->add_hook('newreply_end', 'mystuff');
function mystuff()
{
 global $message;
 $message = preg_replace(...);
}

AJAX quoting is a little more difficult. I generally use something like this:
$plugins->add_hook('xmlhttp', 'mystuff2');
function mystuff2()
{
	global $mybb;
	if($mybb->input['action'] != 'get_multiquoted') return;
	ob_start();
	
	function mystuff2_shutdown()
	{
		global $message;
		if(!$message)
		{
			ob_end_flush();
			return;
		}
		
		ob_end_clean();
		$message = preg_replace(...);
		echo $message;
	}
	register_shutdown_function('mystuff2_shutdown');
}

I'm not sure if it works on all servers though.
Thanks.
Will try your code.