MyBB Community Forums

Full Version: How to make the MyBB Error Message Template to appear for Post Messages?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Here is my code so far:


if(isset($post['message'])) {
	if ($post['message'] == 'test') {
		echo 'Error Message Template with my own custom writing';
	}
}

Here is what I need to do:

1. Make the MyBB Error Message Template to appear, with my own writing.
But I don't want to echo this, or it will just echo text at the top of the page. How would I make the MyBB Error Message Template to appear, where it usually appears? The light orange/yellow one.

2. Block the user from clicking the Post Button (obviously), and to show them this error.

How would I do this?
could not understand why you need to block a specific word / phrase (we use word filters)

also we use minimum number of characters for the post content
admin panel >> configuration >> settings >> Posting --> Minimum Message Length

~/datahandlers/post.php#L295-L307
Hi .m. I'm not blocking a specific word, I just put the word 'test' as a test example.

I need it for a few other things that I need blocked, like URL's, but my questions was referring to just the MyBB Error Message Template to appear for Post Messages.

Would you happen to know how I would do that?

Surely isn't there like a set_error way of doing it?

EDIT: I think I did it. I needed:


$this->is_validated = false; 
$this->set_error("my_custom_error");

Instead of the echo. Does that look right? I'm still learning PHP, so I may be wrong, but it seems to work.

Thanks .m.!
Surprisingly you helped me get the answer, because you linked me to this page which showed me how it is done. ~/datahandlers/post.php#L295-L307