vBulletin Mods

The Official vBulletin Modifications Site
http://www.vbulletin.org/forum/showthread.php?t=83390

Custom Hooks
by Paul M
19 Jun 2005 17:57

I've not seen this mentioned anywhere yet - but you don't need to edit the hooks_vbulletin.xml file to add custom hooks, you can create your own files in the same manner as cpnav files.

For instance, you could create a file called hooks_custom.xml file (as below) and just drop it in the xml folder.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

They appear at the top of your hooks list in ACP.

This way your custom hooks will not get overwritten each time you upgrade. You could also supply a hooks_<hackname>.xml with custom plugins if required.

Wild-Wing 26 Jan 2006 02:14

thats a great idea. that will come in handy sometime

Paul M 26 Jan 2006 02:26

Good grief, I'd forgotten I even posted this ..... :)

Wild-Wing 26 Jan 2006 03:01

lol. how could you?!

timetunnel 29 Nov 2006 08:15

Hello.

What does this mean:

Fatal error: Cannot break/continue 1 level...


I've added a custom hook. It's located in a 'foreach' statement.

All I did was move a chunk of code that tested fine to a new plugin and added a custom hook location in its place. I used a custom 'Product' instead of vBulletin. That chunk of code started off with a conditional statement that pertained to a usergroup permission. For the usergroup that didn't meet the condition, that error message mentioned above appeared. The usergroup that met the condition had no error. This error did not exist before the custom hook-to-code replacement.

Any ideas? I love this thread's instructions.

Thanks in advance.


Edit: The answer is found at: http://www.vbulletin.com/forum/showthread.php?t=168513

It basically says that hooks can't be added to 'foreach'...
That thread does make a suggestion, though.

Muellmann 03 Jan 2007 20:04

Thanks Paul, that's an awesome Info. Now my custom Hooks will be not overwritten if i will make an vb update again ;)
I didn't realize before that custom hooks could be also in a separate File.

Augustino 04 Jan 2007 01:20

What adventages have the hook over the includes?

I could think than the hooks give more resources usages or not? or these are saved in the datastore?

Danny.VBT 04 Jan 2007 02:25

Quote:

Originally Posted by Augustino (Post 1150247)
What adventages have the hook over the includes?

I could think than the hooks give more resources usages or not? or these are saved in the datastore?

If your modification allows flexibility where Administrators can extend the modification, hooks will allow them to do without editing the files.

coderphp 04 Jan 2007 12:48

thanx for the info

bchertov 05 Jan 2008 01:21

Quote:

Originally Posted by coderphp (Post 1150537)
thanx for the info

Ditto! Where's the "Thanks" button??

bchertov 10 Jan 2008 20:23

Quote:

Originally Posted by Paul M (Post 669234)
For instance, you could create a file called hooks_custom.xml file (as below) and just drop it in the xml folder.

Thanks again for this tip, Paul M!
Would you please edit your first post to specify the includes\xml folder so it don't have to hunt for it each time? Thanks!

Opserty 11 Jan 2008 15:31

Quote:

Originally Posted by bchertov (Post 1419094)
Thanks again for this tip, Paul M!
Would you please edit your first post to specify the includes\xml folder so it don't have to hunt for it each time? Thanks!

Theres only one XML folder in all of vBulletin. :P

jim6763nva 18 Apr 2008 01:56

How do you know when to use a hook and when not to. I'm very new to vb programming. :)

Jim

Boofo 21 Jun 2008 09:42

Maybe someone should mention were these hooks are added?

yotsume 15 Aug 2009 13:26

Ok Paul your my Code God! With this simple xml file I am now able to quickly make my own hooks to call vbblog, experience, or any other mod that was using the $template_hook[profile_left_last] hook and putting importnat tabs lost in that left side garbade pale location on profile pages!

No I just make my custom hook name plce in the the MEMBERSINFO template, change the plugin hook location from: $template_hook[profile_left_last] to my cutom hook and poof! I have complete profile tab control once and for all!

TANK YOU!!!


All times are GMT. The time now is 03:14.

Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright ©2001 - , vbulletin.org. All rights reserved.