View Full Version : How do you create a custom hook?
spondishy
05-27-2012, 07:49 AM
Hi I've had a look around and I'm wondering if there is a tutorial/post explaining the steps to create a custom hook.
Thanks.
Do you mean plugin hook or template hook?
For plugin hooks, you'd create an xml file named hooks_something.xml (replace the "something" with some unique identifier) and put it in the includes/xml folder. To see the required format, look at one of the existing "hook_" files. Then you just need to insert code like this where you want your hook called:
($hook = vBulletinHook::fetch_hook('my_hook_name')) ? eval($hook) : false;
and obviously you'd change 'my_hook_name' to whatever you choose to name each hook.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.