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 10-09-2008, 12:46 PM
Jhonnyf's Avatar
Jhonnyf Jhonnyf is offline
 
Join Date: Nov 2007
Location: In my mind
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default which hook I should use, to take a variable in postbit and SHOWTHREAD

I use this php code in showthread_complete hook and work in SHOWTHREAD template
PHP Code:
if(stristr($thread[mycustomfield], $vbulletin->userinfo['username']) == TRUE)
{
$userok TRUE;

but I need the result of $userok in postbit template... and when I use a hook like "showpost_post" I can't read $thread[mycustomfield]...

some idea? I need the variable $userdok created using my custom field in thread table.. and that result use to in postbits template..... and I not want to make a SQL sentency for know that field of the table for each postbit

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

showthread_complete is after the postbits have been evaluated. You need to get that data before postbits are evaluated, then in postbit(_legacy), use $GLOBALS[userok].
Reply With Quote
  #3  
Old 10-10-2008, 10:00 PM
Jhonnyf's Avatar
Jhonnyf Jhonnyf is offline
 
Join Date: Nov 2007
Location: In my mind
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

excelent, then I need to use showthread_post_start (yeah, now work) I'm always forget that in postbit I need use $GLOBALS

Thank you
Reply With Quote
  #4  
Old 10-17-2008, 02:00 PM
Pure Dope Pure Dope is offline
 
Join Date: Dec 2006
Posts: 165
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is a HOOK the same thing as a EVENT?

Hooks get fired, the same way events get fired?
Reply With Quote
  #5  
Old 10-17-2008, 02:13 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not sure what an Event is. If you look at a vB script, php page, you will see 'hooks' scattered throughout. Those are places you may insert your own php code through the use of plugins. You may want to read up on Products and Plugins in the manual.
Reply With Quote
  #6  
Old 10-17-2008, 02:24 PM
Pure Dope Pure Dope is offline
 
Join Date: Dec 2006
Posts: 165
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
I'm not sure what an Event is. If you look at a vB script, php page, you will see 'hooks' scattered throughout. Those are places you may insert your own php code through the use of plugins. You may want to read up on Products and Plugins in the manual.
well in .NET every time a page load.......events are fired....

like there is a Page_Init event, Page_Load, Page_PreRender, etc...

you can wire up methods to those events....

something like

Code:
override protected void OnInit()
{
     this.PreRender += new EventHandler(this.Page_PreRender);
}

void Page_PreRender()
{
     throw new Exception("Your Method Executed!");
}
So when the page is loading...your function will execute...when that event fires.
Reply With Quote
  #7  
Old 10-17-2008, 02:52 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, I guess they are kinda similar. Hooks are page specific, although sometimes the hook is in a page that is run on several pages (like if the hook is in global.php). Like, if you hooked into the hook "member_start" then you are adding code to the beginning of the member.php page, so it only gets executed then. If you hooked into the hook "global_start", then you are adding code to the global.php page which gets executed on nearly every page.
Reply With Quote
  #8  
Old 10-18-2008, 10:25 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Pure Dope View Post
well in .NET every time a page load.......events are fired....

like there is a Page_Init event, Page_Load, Page_PreRender, etc...

you can wire up methods to those events....

something like

Code:
override protected void OnInit()
{
     this.PreRender += new EventHandler(this.Page_PreRender);
}

void Page_PreRender()
{
     throw new Exception("Your Method Executed!");
}
So when the page is loading...your function will execute...when that event fires.
Although hooks are not exactly events, there function similarly. Script execution will reach a defined hook point, and any plugins at that hook will execute.
Reply With Quote
  #9  
Old 10-18-2008, 10:26 PM
Jhonnyf's Avatar
Jhonnyf Jhonnyf is offline
 
Join Date: Nov 2007
Location: In my mind
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Pure Dope View Post
Is a HOOK the same thing as a EVENT?

Hooks get fired, the same way events get fired?
if you look this like a programmer, yes, the hook its like a event beacuse you can add code when something is happening
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 10:52 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.04669 seconds
  • Memory Usage 2,246KB
  • Queries Executed 11 (?)
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
  • (2)bbcode_code
  • (1)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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_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