![]() |
Autocreate new thread .... BUT .... !!
I am coding a hack which auto creates a new thread in a specified forum.
However, how could I get hold of the threadid after it has been created ? Any ideas ? Basically, creation of the thread is solved, but i would need to threadid, in order to say delete or modify that entry. Any help pls ? :) |
Hmm, poked around a bit, and this turned up.
PHP Code:
|
nope ;)
that's why build_new_post get's a reference to the $post array, so after you have used build_new_post the threadid is stored in $post['threadid'] already :) |
actually Xenon, you are wrong. after running the insert query, insert_id() will return the threadid of the newly created thread. So, yes cinq, you are right about that.
|
It's much easier to put the post information for the new thread into a $post array and call the existing build_new_post function. Once it completes, it will put the thread id of the newly created thread into threadinfo['threadid']. There's no need to run another query.
|
it doesn't run another query. :)
|
Erm .... now I'm confused .... :p
So what's the 'verdict' ? |
if you want to insert the new thread "manually" by writing the query yourself, you can get the threadid by using the insert_id() function. Using insert_id will not count as another query.
or, you can use the build_new_post function. |
Yep, I write the query myself.
So insert_id() it is then :) Thanks rake, thanks everyone :D |
erm rake, you are wrong here.
build_new_post runs two queries when creating a new thread, one for the post and one for the thread. as the post query is executed after the thread query the insert_id will give you the postid but not the threadid :) |
All times are GMT. The time now is 08:57 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|