Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
Custom Hooks
Paul M
Join Date: Sep 2004
Posts: 23,575

Nottingham, UK
by Paul M Paul M is offline 19 Jun 2005
Rating: (1 vote - 5.00 average)

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.
Views: 11430
Reply With Quote
Comments
  #2  
Old 26 Jan 2006, 01:14
Wild-Wing Wild-Wing is offline
 
Join Date: Dec 2005
thats a great idea. that will come in handy sometime
Reply With Quote
  #3  
Old 26 Jan 2006, 01:26
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Real name: Paul Marsden
Good grief, I'd forgotten I even posted this .....
__________________


Lead Developer, vBulletin.Org & vBulletin.Com
Please do not PM me about custom work - I no longer undertake any.

Note: I will not answer support questions via e-mail or PM - please use the relevant thread or forum.
Cable Forum - DigiGuide
Reply With Quote
  #4  
Old 26 Jan 2006, 02:01
Wild-Wing Wild-Wing is offline
 
Join Date: Dec 2005
lol. how could you?!
Reply With Quote
  #5  
Old 29 Nov 2006, 07:15
timetunnel timetunnel is offline
 
Join Date: Sep 2005
Question

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.

Last edited by timetunnel : 29 Nov 2006 at 20:16. Reason: UPDATE
Reply With Quote
  #6  
Old 03 Jan 2007, 19:04
Muellmann's Avatar
Muellmann Muellmann is offline
 
Join Date: Jun 2006
Location: near keyboard
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.
Reply With Quote
  #7  
Old 04 Jan 2007, 00:20
Augustino Augustino is offline
 
Join Date: Dec 2005
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?
Reply With Quote
  #8  
Old 04 Jan 2007, 01:25
Danny.VBT's Avatar
Danny.VBT Danny.VBT is offline
 
Join Date: Oct 2004
Originally Posted by Augustino View Post
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.
__________________
while($coffeeMachine->supply($Danny)) { $Danny->run(); }

Twitter Blog
Reply With Quote
  #9  
Old 04 Jan 2007, 11:48
coderphp's Avatar
coderphp coderphp is offline
 
Join Date: Dec 2006
Location: Egypt
Real name: Mahmoud
thanx for the info
Reply With Quote
  #10  
Old 05 Jan 2008, 00:21
bchertov's Avatar
bchertov bchertov is offline
 
Join Date: Dec 2004
Location: Sonoma County, CA
Real name: Barry
Originally Posted by coderphp View Post
thanx for the info
Ditto! Where's the "Thanks" button??
Reply With Quote
  #11  
Old 10 Jan 2008, 19:23
bchertov's Avatar
bchertov bchertov is offline
 
Join Date: Dec 2004
Location: Sonoma County, CA
Real name: Barry
Originally Posted by Paul M View Post
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!
Reply With Quote
  #12  
Old 11 Jan 2008, 14:31
Opserty Opserty is offline
 
Join Date: Apr 2007
Originally Posted by bchertov View Post
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
Reply With Quote
  #13  
Old 18 Apr 2008, 00:56
jim6763nva's Avatar
jim6763nva jim6763nva is offline
 
Join Date: Oct 2005
Real name: Jim
How do you know when to use a hook and when not to. I'm very new to vb programming.

Jim
Reply With Quote
  #14  
Old 21 Jun 2008, 08:42
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Real name: Rob
Maybe someone should mention were these hooks are added?
Reply With Quote
  #15  
Old 15 Aug 2009, 12:26
yotsume's Avatar
yotsume yotsume is offline
 
Join Date: Jan 2007
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!!!
__________________
Yotsume
Kaydev Media Productions
Check out my mods
:
EYO-AIM, FlashChat Combo-Module for vBadvanced 3.6x or 3.7x
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Article Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump


New To Site? Need Help?

All times are GMT. The time now is 18:16.

Layout Options | Width: Wide Color: