vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   API Question (https://vborg.vbsupport.ru/showthread.php?t=205184)

tdeutsch74 02-12-2009 10:54 PM

API Question
 
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.

Dismounted 02-13-2009 08:33 AM

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

tdeutsch74 02-13-2009 04:54 PM

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.

Dismounted 02-14-2009 11:34 AM

Does the forum have post counts enabled?

tdeutsch74 02-19-2009 04:01 PM

Hi. Yes...post counts are enabled in the forum

DragonBlade 02-19-2009 04:05 PM

Quote:

Originally Posted by Dismounted (Post 1742682)
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).

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

Dismounted 02-20-2009 04:11 AM

Quote:

Originally Posted by tdeutsch74 (Post 1749140)
Hi. Yes...post counts are enabled in the forum

Actually, you should consider using the build_new_post() function, as it will send out subscriptions, notifications, etc as well.


All times are GMT. The time now is 10:07 AM.

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.01040 seconds
  • Memory Usage 1,720KB
  • 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
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete