Brad
09 Jun 2005, 00:50
This guide will teach you how to add your own hook locations to your scripts/default vBulletin source code. Note that I assume that you are working within the vBulletin.php files or you have included vBulletin's global.php.
Adding custom hook locations -
Method one:
See paul's thread here for the best method, if you are going to release your modification to the public this is the way you should go:
http://www.vbulletin.org/forum/showthread.php?t=83390
Method two:
All hooks listed in this drop down live in the .xml file located at /vbroot/includes/xml/hooks_vbulletin.xml
Find this bit of code at the very top of the file:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Looks simple eh? Heres what these tags do
<hooks> - anything between this tag and </hooks> will be included in the drop down
<hooktype type="name"> - The name of your hook group, you should group all common hooks under a group so you can find them quickly. Make sure you don't use a name already used by a default hooktype.
<hook> - The name of your hook, this must be the same as the hook's name in the php code
Here is an example of my .xml file, I added three custom hooks under a new hooktype:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
The php code:
Adding a hook location to the php code is easy, just make sure you use the correct hook name! Use this bit of php anywhere after your call to global.php to call your custom hook. Also note that you must use the $hook var!
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Here is an example of my custom hooks working in vBulletin's index.php file:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
As you can see I added them right under a current hook, which mostly defeats the purpose of making custom hooks. But for this post they serve their purpose ;)
Now all you need to do is browse to your admincp's add new plug-in page and test your new hook location! I use this just to make sure it is working correctly:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
If that outputs its text above the vBulletin header then you are good to go!. :)
Adding custom hook locations -
Method one:
See paul's thread here for the best method, if you are going to release your modification to the public this is the way you should go:
http://www.vbulletin.org/forum/showthread.php?t=83390
Method two:
All hooks listed in this drop down live in the .xml file located at /vbroot/includes/xml/hooks_vbulletin.xml
Find this bit of code at the very top of the file:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Looks simple eh? Heres what these tags do
<hooks> - anything between this tag and </hooks> will be included in the drop down
<hooktype type="name"> - The name of your hook group, you should group all common hooks under a group so you can find them quickly. Make sure you don't use a name already used by a default hooktype.
<hook> - The name of your hook, this must be the same as the hook's name in the php code
Here is an example of my .xml file, I added three custom hooks under a new hooktype:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
The php code:
Adding a hook location to the php code is easy, just make sure you use the correct hook name! Use this bit of php anywhere after your call to global.php to call your custom hook. Also note that you must use the $hook var!
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Here is an example of my custom hooks working in vBulletin's index.php file:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
As you can see I added them right under a current hook, which mostly defeats the purpose of making custom hooks. But for this post they serve their purpose ;)
Now all you need to do is browse to your admincp's add new plug-in page and test your new hook location! I use this just to make sure it is working correctly:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
If that outputs its text above the vBulletin header then you are good to go!. :)