Hi everyone, I'm currently trying to find a workaround to be able to create threads from an external website. The website is on the same server but it has another domain name. I've found a code in this forum (I cannot find the url) for creating a thread from an external form in VB3. This server has VB4 installed, so I took it as a base to do some testing.

Here is the code for the test page (which is the code provided in the thread I mentioned adapted to my needs):

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

This code takes the information from a form through POST method. When I run this script I get the following error:

Fatal error: Call to undefined method stdClass::set() in <route here>/includes/functions.php on line 7344.

The line which throws an error is the following in functions.php:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Now this error is because somehow the vB_Session class is not initialized or defined so PHP take it as an stdClass method (which is not), so I looked for a class definition file which was supposed to be called by global.php through its own required files and I found class_core.php which has the definition of the session class and its methods.

class_core.php is called before functions.php, which makes sense, but somehow it is not working, so I have no way to know if this code works or not.

EDIT: Ok, after reading more threads and docs around there as I am outside of Vbulletin backend I need to define some constants first in order to make this work:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

It's not working yet but the class error doesn't appear anymore. (Now I get a "Unable to add cookies, header already sent." error), I'll keep trying until I can make this work. If anyone has an idea, please let me know. Thanks!.
----------------------------------------------------------------------------------------------------------------------------------------------------------------

--------------- Added 1303763119 at 1303763119 ---------------

Ok, I've managed to do it, here is the right code:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

So basically the thing I was missing was to define the constants VB_AREA, SKIP_SESSIONCREATE and SKIP_USERINFO so I could bypass some VB checks. Now it's working great!

I leave this workaround for those who are interested. Hope it helps someone.

This was the thread I got the code from: http://www.vbulletin.org/forum/showthread.php?t=229654. Thanks megamoose for creating it! It probed to be really helpful.