vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Error hooks (https://vborg.vbsupport.ru/showthread.php?t=255227)

squishi 12-14-2010 09:18 PM

Error hooks
 
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.

kh99 12-14-2010 09:54 PM

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?

kh99 12-15-2010 07:09 PM

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


All times are GMT. The time now is 09:14 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00889 seconds
  • Memory Usage 1,708KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete