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

Reply
 
Thread Tools Display Modes
  #1  
Old 01-28-2014, 05:10 PM
ageurtse ageurtse is offline
 
Join Date: Apr 2009
Location: almelo
Posts: 275
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default hook location newthread

Is there a hook location when i push the post button after writing a new thread.
I can't find it, is it there or do i have to modify somthing so i could get a hook location there.
Reply With Quote
  #2  
Old 01-28-2014, 05:14 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There's probably more than one hook you could use. What do you want to do when the button's pressed?
Reply With Quote
  #3  
Old 01-28-2014, 05:34 PM
ageurtse ageurtse is offline
 
Join Date: Apr 2009
Location: almelo
Posts: 275
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i wan't the person be redirect to a different page, where the user has to fill in some more information. after the info is validated the post has to be released.
if the validation fails the post has to be canceld.
Reply With Quote
  #4  
Old 01-28-2014, 05:46 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, when you're submitting a new post, it goes to newpost.php with do=postthread, so maybe you could use hook newthread_start with code like:
Code:
if ($_REQUEST['do'] == 'postthread' && /* check for validation not done */)
{
    show validation page (i.e., render a template and call print_output(), or do a redirect)
}

I hope that makes sense.
Reply With Quote
  #5  
Old 01-28-2014, 05:56 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Actually, on second thought it might be easier to use hook newthread_post_start. You wouldn't need to do the check for $_REQUEST['do'] == 'postthread' because it's been done already, and the form fields from the new thread page have been cleaned already (you might want to look at newthread.php and search for newthread_post_start to see what's going on there).
Reply With Quote
  #6  
Old 01-28-2014, 06:06 PM
ageurtse ageurtse is offline
 
Join Date: Apr 2009
Location: almelo
Posts: 275
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

When i use that hook location it is called on the start of an new thread, how can it now that i hit the post button?
Reply With Quote
  #7  
Old 01-28-2014, 06:21 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ageurtse View Post
When i use that hook location it is called on the start of an new thread, how can it now that i hit the post button?
Most of the php scripts in vb perform more than one function. newpost.php is called to display the form for a new thread, and also to post the thread (and a few other functions). The "do" parameter is used to tell the script which function is being performed. You might want to take a look at newpost.php to see what's going on. You can see there are different sections, for instance, around line 100 is this code:
Code:
// ############################### start post thread ###############################
if ($_POST['do'] == 'postthread')
{

which is the start of the code that posts a new thread. And a little farther down is this:
Code:
// ############################### start new thread ###############################
if ($_REQUEST['do'] == 'newthread')
{

which starts the section that displays the form for a new thread.

I hope this answers you question - I'm not completely sure I understood.
Reply With Quote
  #8  
Old 01-28-2014, 06:54 PM
ageurtse ageurtse is offline
 
Join Date: Apr 2009
Location: almelo
Posts: 275
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmmmm i can't get it to work

this is what i have done but no pop-up.

hook location newthread_start and newthread_post_start
and this is the code
Code:
if ($foruminfo['forumid'] == 356 && $_REQUEST['do'] == 'postthread')

{
$message = 'This is a message.';
echo "<SCRIPT>
alert('$message');
</SCRIPT>";
}
when i leave $_REQUEST['do'] == 'postthread' away, there is a pop-up only on the hook location newthread_start.

i now i do something wrong or use the wrong hook. but i don't know what.
Reply With Quote
  #9  
Old 01-28-2014, 07:56 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I tried it and it seems to work. Are we talking about the same button? Try adding another message as an "else" to your if, and display $_REQUEST['do'] in the message.
Reply With Quote
  #10  
Old 01-28-2014, 08:59 PM
ageurtse ageurtse is offline
 
Join Date: Apr 2009
Location: almelo
Posts: 275
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well it is the button beside the preview button called post new thread.
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 02:16 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
  • Page Generation 0.06873 seconds
  • Memory Usage 2,252KB
  • 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
  • (4)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete