Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 03-08-2008, 02:17 PM
yellowpinky yellowpinky is offline
 
Join Date: Apr 2003
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Any simple example of how to use a hook?

I'd like to replace a hook statement with some custom code.
I presume that is possible??

Example: in Template postbit

there is a line:
Code:
$template_hook[postbit_start]
What I would like is to do a print "ZZZZZZZZZZZZZZZZZ";
right where where that line is.

What are the steps needed to make this happen?
like do I create a file called postbit_start somewhere?

Thank you.
Reply With Quote
  #2  
Old 03-08-2008, 03:09 PM
shovel's Avatar
shovel shovel is offline
 
Join Date: Mar 2002
Location: South Carolina, US
Posts: 222
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$template_hook[postbit_start] is a variable for the comment within the HTML when the postbit template is rendered. If you would like to print something dynamically within that template, follow the following example.

Postbit Template:
Code:
$template_hook[postbit_start]
$myPostbitAddition
Goto...
AdminCP -> (left menu) Plugins & Products -> Plugin Manager

Fill out the form with the following information...

Product: vBulletin
Hook Location: postbit_display_complete
Title: My Postbit Addition
Execution Order: 5 (default)
Plugin PHP Code:
PHP Code:
$myPostbitAddition 'ZZZZZZZZZZZZZZZZZ'
Plugin is Active: Yes

Click "Save" and continue on to your forums and view the Postbit within a thread. You should see your variable printed within each Postbit render.

Hope this helps!

- shovel
Reply With Quote
  #3  
Old 03-09-2008, 02:30 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Errr, shovel, why would you do that when you can USE the hook? A bit pointless, IMO.

Have a read of: https://vborg.vbsupport.ru/showthread.php?t=147447
Reply With Quote
  #4  
Old 03-09-2008, 01:26 PM
shovel's Avatar
shovel shovel is offline
 
Join Date: Mar 2002
Location: South Carolina, US
Posts: 222
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

As far as I understood he wanted to insert a variable. Either way, I can see your point Dismounted. I tend to over think at times, it happens haha.
Reply With Quote
  #5  
Old 03-12-2008, 11:38 AM
yellowpinky yellowpinky is offline
 
Join Date: Apr 2003
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
$template_hook[postbit_start]
So this line is in there for no reason other than a comment?

how did you make the jump to the hook: postbit_display_complete
I mean, what documentation would say, to use postbit_start
add a hook for, postbit_display_complete?

I'm so clueless here.


The other post: https://vborg.vbsupport.ru/showthread.php?t=147447
is a listing of hooks, not any instructions how how to use them. How do you use these things, called hooks?

It includes: $template_hook[postbit_start]
But why, if it is just a comment, and therefore unusable(?)
It makes no mention of postbit_display_complete, the one you presumably should use.
Reply With Quote
  #6  
Old 03-13-2008, 05:36 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
$template_hook[postbit_start]
It is a PHP variable you can use to insert data through plugins. You add plugins through the Admin CP > Plugins & Products > Add New Plugin.
Reply With Quote
Reply


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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:07 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04810 seconds
  • Memory Usage 2,208KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete