MyBB Community Forums

Full Version: Pointing error_no_permission to a custom page?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a static site, and my forum located in a subfolder called /forum. What I want to know is, is it possible to point error_no_permission to a custom page located at www.mysite.com/errors/noperm.html? I scanned the function and I can't see where I could edit it to point there.
Of course, if it's possible, I'd prefer it without a Header or a JS redirect, if not, I'll use JS.
You'd have to hook into the error function and check if the error message given is identical to the error_no_permission string. That is how Google SEO 404 determines which error code to give to which error page. You could just as well set a redirect there instead of a HTTP error header. Nicer than a redirect though would be to simply output your own page directly, so the browser does not have to send yet another request to the server just to get an error page.

EDIT:
Actually in the no_permission case there is a no_permission hook for it. Wink
So all you need is a hook.
How would I go about outputting my own page? Tried replacing error($errorpage) with error(file_get_contents(MYBB_ROOT."index.php")) and output_page(file_get_contents(MYBB_ROOT."index.php")) as a test - neither worked.
Can't you write a custom output_page function and hook at pre_output_page to wrap your page contents? That is what I do.

Or you can as well just write a custom error_no_permission function that is plugin-friendly.