vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How to programmatically post to a thread (https://vborg.vbsupport.ru/showthread.php?t=238411)

ishiboo 03-16-2010 03:54 PM

How to programmatically post to a thread
 
I need to programmatically post to a thread. I examined the tables and real threads and came up with a solution, however it does not keep the thread "in sync"... there are times where members cannot browse to the latest page.

Is there a guide for doing this? I know there are some 3rd party addons but I'd prefer to be able to do it myself in code. Here is what I'm running:

Code:

INSERT INTO vbulletin.post SET threadid = THREADID, parentid = POSTID, username = 'Username', userid = USERID, title = '', dateline = unix_timestamp(now()), pagetext = 'test', ipaddress = '127.0.0.1', visible = 1

UPDATE thread SET lastpostid = NEWPOSTID, lastposter = 'Username, dateline = UNIX_TIMESTAMP(NOW()) WHERE threadid = THREADID LIMIT 1

THREADID is the id of the thread I'm posting to. POSTID is the ID of the first post. USERID is the user ID of the member. Everything works except the thread paging/timeline issue I mentioned. NEWPOSTID is the id of the post which was just inserted.

Marco van Herwaarden 03-17-2010 09:49 AM

You should not insert directly into these tables, there is a lot more to it. Instead use the DataManagers, see our articles section on how to use them.


All times are GMT. The time now is 02:58 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.00911 seconds
  • Memory Usage 1,708KB
  • 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
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)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