Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 25 Apr 2011, 17:39
rey maximo rey maximo is offline
 
Join Date: Apr 2011
Create Thread from an external page

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):


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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.

Any ideas/suggestions?

Thanks in advance!

----------------------------------------------------------------------

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:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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 25 Apr 2011 at 20:25 ---------------

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


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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.

Last edited by rey maximo : 25 Apr 2011 at 20:25. Reason: Auto-Merged DoublePost
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump


New To Site? Need Help?

All times are GMT. The time now is 04:22.

Layout Options | Width: Wide Color: