MyBB Community Forums

Full Version: Allow Custom Error in error_no_permission
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I just thought while I was in the shower (I know, TMI) that it might be nice if a custom error string could be passed into the error_no_permission function.

Basically, just add a parameter to the function definition, such as $customerror, and if it is defined, display that error instead of the default one which isn't always correct in all situations.

This would allow plugin developers to create much more informative errors without much excess work.

Note: I am unsure if there is a separate function like this already for plugins, and I didn't feel like hunting in the Sourcedocs to find out. And remember, I am not a plugin dev yet, so I am still minimally familiar with functions provided to plugins by MyBB.

Thanks!
error() does the exact same thing. Simply pass your message along with it. You could even pass the language string first, then a custom message.
Well, I wasn't aware of that.

I guess that pretty much closes this. I kind of had the suspicion in my mind of this already existing.
You can explore MyBB to the fullest at http://www.mybb.com/sourcedocs
(2012-04-01, 09:50 PM).H luaP Wrote: [ -> ]You can explore MyBB to the fullest at http://www.mybb.com/sourcedocs

That's where I went to look at the error_no_permission method. I just didn't know where a plugin error() function would be.
error('Message');

^ Is that what you want?
I don't specifically need it, I just didn't realize the functionality existed already, or that it was core.