[resolved] 1.8.3 on datahandler_post_insert_thread find PID and TID
#1
I need the TID and PID, or a link to the new thread when the post is submitted. Is this at all possible or is there a better way of going about this?

I'm currently hooking datahandler_post_insert_thread, but all the TID's and PID's are 0 or unset (so says print_r). I'm using globals.
Reply
#2
It depends on the exact operation that's happening. If you hit the path where an existing post is being updated (eg: going from a draft to live) you should be able to use $thread['tid'].

If it's a brand new thread, you will need to use the "datahandler_post_insert_thread_post" hook:

PHP Code:
$plugins->add_hook('datahandler_post_insert_thread_post''testFunc');
function 
testFunc($handler)
{
    
$tid $handler->tid;


Unfortunately at that point, only the TID is available, not the PID - the post isn't inserted until just after that hook is ran.
Reply
#3
(11-23-2017, 06:42 PM)Euan T Wrote: It depends on the exact operation that's happening. If you hit the path where an existing post is being updated (eg: going from a draft to live) you should be able to use $thread['tid'].

If it's a brand new thread, you will need to use the "datahandler_post_insert_thread_post" hook:

PHP Code:
$plugins->add_hook('datahandler_post_insert_thread_post''testFunc');
function 
testFunc($handler)
{
 
   $tid $handler->tid;


Unfortunately at that point, only the TID is available, not the PID - the post isn't inserted until just after that hook is ran.

Mate life saver. TYVM. <3
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)