Log in

View Full Version : Posting into vB from a non-vB Page


Cryo
05-27-2008, 05:48 PM
Hello,

I have an script on my site which creates a new thread on the vB forums. Ever since I upgraded it is no longer working, the page will give me an error with the following -

Fatal error: Database object is not an object in [path]/includes/class_dm.php on line 172

So I'm assuming things have changed. How do I make this possible now in 3.7.1?

Lynne
05-27-2008, 06:49 PM
Why don't you post the part of the code around line 172.

grenma
05-27-2008, 10:39 PM
I'm assuming you have the same codebase as us, but it is the trigger_error in this function:

/**
* Constructor - checks that the registry object has been passed correctly.
*
* @param vB_Registry Instance of the vBulletin data registry object - expected to have the database object as one of its $this->db member.
* @param integer One of the ERRTYPE_x constants
*/
function vB_DataManager(&$registry, $errtype = ERRTYPE_STANDARD)
{
if (!is_subclass_of($this, 'vB_DataManager'))
{
trigger_error("Direct Instantiation of vB_DataManager class prohibited.", E_USER_ERROR);
}

if (is_object($registry))
{
$this->registry =& $registry;

if (is_object($registry->db))
{
$this->dbobject =& $registry->db;
}
else
{
trigger_error('Database object is not an object', E_USER_ERROR);
}
}
else
{
trigger_error('Registry object is not an object', E_USER_ERROR);
}

$this->set_error_handler($errtype);

if (is_array($this->bitfields))
{
foreach ($this->bitfields AS $key => $val)
{
if (isset($this->registry->$val))
{
$this->bitfields["$key"] =& $this->registry->$val;
}
else
{
trigger_error("Please check the <em>\$bitfields</em> array in the <strong>" . get_class($this) . "</strong> class definition - <em>\$vbulletin->$val</em> is not a valid bitfield.<br />", E_USER_ERROR);
}
}
}
}

Lynne
05-27-2008, 11:42 PM
I'm assuming you have the same codebase as us, but it is the trigger_error in this function:

I never make the assumption that somebody has not modified their code. Making that assumption has caused too many problems for me before.

Cryo
05-28-2008, 02:31 PM
The vB files are unmodified. The script I'm using invokes a vB class --

$threaddm = new vB_DataManager_Thread_FirstPost($vbulletin, ERRTYPE_STANDARD);

From there I build the thread's information (poster, subject, forum) and then process it. It worked fine in previous versions, so I'd imagine the method of posting has changed a little since.

Lynne
05-28-2008, 03:02 PM
Hey Cryo,

I did some searching around about your problem and found others with the same problem but no solution yet. You might want to make a post in the Programming forum and post the part of your code that creates the new user and then post your error. That might get you the attention you need. Unfortunately, I can't offer a solution.

Cryo
05-28-2008, 05:54 PM
Thanks for looking into it, Lynne. I searched around a bit too and couldn't find anything either. :(