[How-to] Hooks and Plugins
In hooks_vbulletin.xml you will see things like the following:
Code:
<hooktype type="general"> The PHP code in the vB files looks like the following: Code:
($hook = vBulletinHook::fetch_hook('global_start')) ? eval($hook) : false; To make a plugin hooked to global.php, you create an XML file as follows: Code:
<?xml version="1.0" encoding="ISO-8859-1"?> Code:
($hook = vBulletinHook::fetch_hook('global_start')) ? eval($hook) : false; via <hookname>hook_name</hookname> from the plugins, which needs to match the fetch_hook('hook_name') in the vB PHP code, which needs to match <hook>hook_name</hook> in hooks_vbulletin.xml. You can even make a plugin that hooks to multiple vB PHP files as follows: Code:
<?xml version="1.0" encoding="ISO-8859-1"?> Code:
($hook = vBulletinHook::fetch_hook('global_start')) ? eval($hook) : false; Code:
($hook = vBulletinHook::fetch_hook('forumhome_start')) ? eval($hook) : false; matches fetch_hook('hook_name') in the vB PHP code matches <hook>hook_name</hook> in hooks_vbulletin.xml. Further readings... What is a hook: - https://vborg.vbsupport.ru/showpost....9&postcount=11 How to make a plugin: - https://vborg.vbsupport.ru/showpost....5&postcount=14 How to add a new hook location: - https://vborg.vbsupport.ru/showpost....01&postcount=1 |
the devkeys in the opening plugin tags mustn't be equal
|
Okay, thanks, updated.
|
calorie, Thank you for explaining that. I had someone tell me what a hook was and I kind of got my brain wrapped around the idea, but you finished off the explaination really well. I'm a visual thinker and the way you explained how this will work was good for me.
|
Thanks. KirbyDE was helping me to understand, along with the authors of the other posts I listed, so I'm glad that you found it useful, and that I got to "pay it forward." :)
|
Thanks calorie -- nice job!
|
I still don't understand much about the plugin and hooks... somebody should write a dutch how-to (Floris maybe?)
|
Are there restrictions on what can go inside the
Code:
//Start PHP Code
Stuff like that... Thanks! |
I have ran into several roadblocks on this new plugin situation and it is frustrating to say the least.
Entering in SQL queries seem to work, but eval codes for template calls (even by the new standard like error templates) cause errors. I am pretty sure it is user error on my end, but what would be really nice to see for once is a real life example of a mysql plugin-template exchange within a plugin so we have a general idea of what needs to be done in order to make it work properly. Ok, starting to get the hang of it. I still prefer the old way of simply creating a include script to handle all of my hacks, but I can also see where the plugin manager will be beneficial for many areas such as a seperate front page with left, middle and right columns similar to the old Nuke class system. Quote:
The SQL queries will work as well, but you have to use the new format which was posted by VBLuke earlier, in which Keir created a document on those new settings. A example of what I did with just a very elementary and simple condition within a plugin was this: Code:
if ($vbulletin->userinfo['userid'] == 1){ |
All times are GMT. The time now is 06:24 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|