The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Create a thread remotely
My goal is simple. I need a PHP class which can interface with my external CMS in the following way:
1) create an article in CMS. 2) on completion of CMS submission, call a PHP function from my custom class (probably via HTTP request) which will insert a new thread into a dedicated vb forum, using the title and body of the new article - and returning to the calling app the id of the newly created forum thread. 3) provide a function which can be called from the CMS each time the page loads to get the number of replies. I have so far found one discussion of this, here: https://vborg.vbsupport.ru/showthread.php?t=181689 But the code sample is tantalisingly incomplete... I would love to see a full working example rather than just a snippet. I would have thought this problem would have been solved a hundred times over by now? Any pointers? thanks. |
#2
|
|||
|
|||
<a href="https://vborg.vbsupport.ru/showthread.php?t=102418&page=3#39" target="_blank">https://vborg.vbsupport.ru/showt...2418&page=3#39</a>
|
#3
|
|||
|
|||
my guess is that the essence is in the following:
PHP Code:
Is there any documentation for the code? thanks (: |
#4
|
|||
|
|||
Check the thread datamanager files in the include directory. class_dm_thread*.php
TYPE_xxx defines their type and requirements. --------------- Added [DATE]1213523255[/DATE] at [TIME]1213523255[/TIME] --------------- Maybe of interest: Data Managers |
#5
|
|||
|
|||
Quote:
in the example you referenced there is a variable $vbulletin which is passed as a parameter to the datamanager_init function. How is that variable created? Also wondering which php files I need to require for datamanager_init to work. PHP Code:
Quote:
--------------- Added [DATE]1213524531[/DATE] at [TIME]1213524531[/TIME] --------------- PHP Code:
Quote:
I am guessing that maybe I don't need it because in the sample code it is only used to fetch an id - but in my case I will be passing that as a separate param: PHP Code:
--------------- Added [DATE]1213525869[/DATE] at [TIME]1213525869[/TIME] --------------- OK, small question: where does the function datamanager_init live? This seems to be the key to it all. it would be nice if there was a working sample that showed what needs to be in the required path etc.. --------------- Added [DATE]1213526137[/DATE] at [TIME]1213526137[/TIME] --------------- OK I found it in functions.php so i guess I need to start with something like: PHP Code:
In the comments for datamanager_init we see: PHP Code:
--------------- Added [DATE]1213527347[/DATE] at [TIME]1213527347[/TIME] --------------- OK, looks like I need something like the following: PHP Code:
OK, I have no confirmed that the above DOES NOT WORK. Can anyone tell me what is wrong with the code or should I just give up? --------------- Added [DATE]1213531637[/DATE] at [TIME]1213531637[/TIME] --------------- The following is tested and WORKS: PHP Code:
NOTE: The file needs to be placed at the root level of your vbulletin installation. |
#6
|
|||
|
|||
If you just include global.php it includes init.php and functions.php. If you want to move out of the forum root use chdir()
E.g.: PHP Code:
|
#7
|
|||
|
|||
I'm pretty much lost at this point. Here is the code I have...
PHP Code:
Fatal error: Database object is not an object in [path]/includes/class_dm.php on line 172 I have the global.php included and directories are correct... like I said, this all worked pre-3.7. Any ideas? The output and title variables are set, by the way. --------------- Added [DATE]1214074111[/DATE] at [TIME]1214074111[/TIME] --------------- OK, so I took the code and put it into its own page and it works fine. Putting it into the page's IF statement seems to break it and gives me the error indicated above. |
#8
|
||||
|
||||
Please post the whole page.
|
#9
|
|||
|
|||
I did read the whole page. The code I have works if it is OUTSIDE the post statement, once it is inside it stops functioning (which renders it worthless). I may be missing it, but I don't see that problem addressed here. If it was, please point me to the post / segment which gives resolution.
|
#10
|
||||
|
||||
Please post the whole page. The whole code you are using.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|