vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   hook location newthread (https://vborg.vbsupport.ru/showthread.php?t=307626)

ageurtse 01-28-2014 05:10 PM

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.

kh99 01-28-2014 05:14 PM

There's probably more than one hook you could use. What do you want to do when the button's pressed?

ageurtse 01-28-2014 05:34 PM

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.

kh99 01-28-2014 05:46 PM

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.

kh99 01-28-2014 05:56 PM

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).

ageurtse 01-28-2014 06:06 PM

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?

kh99 01-28-2014 06:21 PM

Quote:

Originally Posted by ageurtse (Post 2477542)
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.

ageurtse 01-28-2014 06:54 PM

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.

kh99 01-28-2014 07:56 PM

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.

ageurtse 01-28-2014 08:59 PM

Well it is the button beside the preview button called post new thread.


All times are GMT. The time now is 05:48 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01057 seconds
  • Memory Usage 1,744KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete