The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How Do I: Create a New Thread from an external PHP Script
I've been searching and searching but cannot find 1 clear, easy to follow solution.
Currently I have an external PHP file (i.e. sitting outside the vB /forum/ folder) that can create a NEW Posts against an EXISTING Thread. Referenced: -------------------------------------- Create Posts https://vborg.vbsupport.ru/showthrea...highlight=Data And for Using vBulletin-powered scripts outside vBulletin Directory... [How-To] vBulletin API Basics: Creating Custom Pages & Misc. https://vborg.vbsupport.ru/showthread.php?t=98009 -------------------------------------- Now I want to create a NEW Thread against an EXISTING Forum. Referenced: https://vborg.vbsupport.ru/showpost....3&postcount=39 Here's my code thus far... PHP Code:
--------------- Added [DATE]1210826124[/DATE] at [TIME]1210826124[/TIME] --------------- p.s. This is my first crack at using vBulletin - I need to write a custom API to communicate with vB (for now to create New Threads and New Threads with Posts). The vB manual has some handy information but it seems to lack 'clear' examples of USING DataManagers to achieve simple tasks such at creating a new post and/or thread and populating it with data (e.g. from a submitted form). I know it's going to be possible to do... I just can't figure it out :| |
#2
|
||||
|
||||
What is your problem? It looks like you've got it down.
|
#3
|
|||
|
|||
PHP Code:
My previous code seemed to just not work... I was banging my head against a wall. Eventually I ended up with the code posted above - which seems to work (a New thread is created and the forums counters are updated). If anyone has suggestions on improving my script please comment. |
#4
|
|||
|
|||
This seems to work for me
PHP Code:
https://vborg.vbsupport.ru/showpost....3&postcount=23 |
#5
|
|||
|
|||
How would I go about using the code in this thread to automatically create a discussion thread using the information from a News Thread (which doesn't allow replies). I can run the script and it creates the thread but I cant figure out how I would go about passing the information to it OR making it run on clicking the submit button to create a thread on a specific forum
|
#6
|
||||
|
||||
You can use a plugin at newthread_complete to run the code as a new thread is created. Look above that hook, and you will see the variables for the current thread that is being submitted.
|
#7
|
|||
|
|||
Quote:
Any advice would be appreciated. Oh and what did youy mean by "look above that hook" |
#8
|
||||
|
||||
He means go find the hook newthread_complete in the code and look at the code in the page above it.
|
#9
|
|||
|
|||
Any hints to which file the relevent code will be in, or do I just need to go through every script?
|
#10
|
||||
|
||||
Does your text editor not allow you to search in a folder? If not, I would highly recommend finding an editor that does - I couldn't live without that feature.
I would guess that since the name of the hook is newthread_complete, that it is in the newthread.php script (however, I have no hook called newthread_complete in either my 3.6.8 board or my 3.8.0 board, so I'm guessing you guys are talking about a different hook). |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|