MyBB Community Forums

Full Version: [solved] How to add hook to replace [php] and [code] tags?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,..

I want to add syntax my own php syntax.

I have try to create plugin, the function like this:

function jin_syntax_run($message) {
	$find = '#\[php\](.*?)\[/php\]#i';
	$replace = '<pre>$1</pre>';
	$message = preg_replace($find, $replace, $message);
	return $message;
}

But, it doesn't work at all.
EDIT: it works, hook should use parse_message_start
And just wait for effect, because cache posts, or just create new post.
can you teach me how to do this? thanks?