View Full Version : Error hooks
squishi
12-14-2010, 09:18 PM
Hi! I want to execute something when a visitor of my forum hits a 404 error page.
I found three plugin hooks that are related to errors:
error_fetch
error_generic
error_nopermission
In which php files are they?
Which one would I use?
And how would I test in such a plugin if the page is a 404 error page?
I want it to execute only on 404 errors. So I don't want to add an error check on regular forum pages.
Hmm...maybe it's something in vB I don't know about, but I think a 404 error is a web server thing, in which case there wouldn't be any error handling for it in vB.
If that's true, then you might be able to configure your web server to forward to a custom vB page (or wherever you want) on a 404 error.
squishi
12-15-2010, 06:45 PM
I checked it on here and vbulletin.com and you are right. The 404 server error is shown.
Not on my forum, though.
I have set up a redirect so that members profiles can be reached by going to mydomain.com/username
If a user is not found, a template with an error message is shown. The error message is stored in the phrase "unregistereduser".
I cannot find this phrase in my templates.
It must be used in a php file directly.
I think the page that shows this error message is using the "STANDARD_ERROR" template.
Is there a way to hook into this page with a plugin?
I see. I think you might be able to make a plugin using the error_fetch hook location and check for that phrase ($args[0] == 'unregistereduser'), and then redirect somewhere else (maybe by calling standard_redirect()).
ETA: error_fetch in in includes/functions.php
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.