PDA

View Full Version : Post New Thread from Separate PHP Script


jaslon
03-14-2009, 07:40 PM
I would like to write a php script to post a weekly summary of data from a non-vBulletin based part of my site. I will run this script automatically every week using a cron-job. The data should be posted as a new thread in a News & Annoncement forum that we run as a sub-forum in vBulletin. The author of the new thread should be a "News Editor" user who is used by us moderators to post news.

Are there any examples to see how others have done something similar in PHP?

Dismounted
03-15-2009, 06:11 AM
This can be done (and should be done) using the vBulletin Data Managers. Some documentation can be found in the vBulletin Manual, as well as in the articles section.

Antivirus
03-18-2009, 01:44 AM
The newthread dms can be a bit overwhelming at first, so I would suggest looking up function build_new_post() in the api. It basically handles all the calls to whatever datamanager you need (most likely threadfirstpost since ypu're creating a new thread). Simply declare thread as first param, then pass it the $newpost array , foruminfo array and should work. Search for it's usage in newthread.php for example to go by.

Dismounted
03-18-2009, 06:17 AM
Yes, the function build_new_post() is probably a good starting point. I forgot about that. :)