The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
Hey all. I'm creating a few custom PHP pages using vBulletin and it's API that create new threads, replies and users. Once I create a new item, I will need to output the newly created id. I see for the User object that the save method returns the new user id, but there is nothing for threads and posts. For these I'm using vB_DataManager_Thread_FirstPost and vB_DataManager_Post.
Does anyone know how I can retrieve the newly created thread id and post id's when I save them using the API? Thank you. |
#2
|
||||
|
||||
![]()
The save() method, when used in inserting a new record, will (nearly) always return the ID of the newly inserted row. The only exception is tables that do not have auto increment values (e.g. customavatar).
|
#3
|
|||
|
|||
![]()
Great that does work. Thanks. I have another quick question. I'm using
vB_DataManager_Thread_FirstPost to create my thread and first post which works, but it is not incrementing the user's post count. I do run build_forum_counters($forum_id); after the save. Any idea how to get that working? Thanks. |
#4
|
||||
|
||||
![]()
Does the forum have post counts enabled?
|
#5
|
|||
|
|||
![]()
Hi. Yes...post counts are enabled in the forum
|
#6
|
||||
|
||||
![]()
XD Thanks for this--in a few of mine, I've been using $vbulletin->db->insert_id() instead, not realizing that the datamanagers return the insert ID already. XP
|
#7
|
||||
|
||||
![]()
Actually, you should consider using the build_new_post() function, as it will send out subscriptions, notifications, etc as well.
|
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|