The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
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 ? |
#2
|
||||
|
||||
Hmm, poked around a bit, and this turned up.
PHP Code:
|
#3
|
||||
|
||||
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 |
#4
|
||||
|
||||
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.
|
#5
|
||||
|
||||
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.
|
#6
|
||||
|
||||
it doesn't run another query.
|
#7
|
||||
|
||||
Erm .... now I'm confused ....
So what's the 'verdict' ? |
#8
|
||||
|
||||
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. |
#9
|
||||
|
||||
Yep, I write the query myself.
So insert_id() it is then Thanks rake, thanks everyone |
#10
|
||||
|
||||
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 |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|