PDA

View Full Version : Using the Database object in the postbit_display_complete hook


dushan26
06-12-2013, 12:50 AM
I'm trying to select something from the database in the postbit_display_complete hook using the database object. I am able to successfully access it using the following syntax:

vB::$db->query_read_slave(...

The problem is I cannot use this syntax in vBulletin 3.7, and I want the product I am making to work in both versions. What I want to do is use:

$vbulletin->db->query_real_slave(...

However with this syntax I am getting the error, "Fatal error: Call to a member function query_read_slave() on a non-object in..."

I find this strange because I am able to use the $vbulletin object just fine in the newpost_process hook.

Any help would be greatly appreciated. Thanks in advance.

Lynne
06-12-2013, 01:15 AM
Why does it have to be the same for 3.7 and 4.x? Your template syntax will most likely not be the same at all.

dushan26
06-12-2013, 01:18 AM
It would be nice if it was all one file, at the moment that is the only piece that needs to be fixed, otherwise it works in both versions.

Lynne
06-12-2013, 01:32 AM
In my vB4 mods, with that hook, I use:

$this->registry->db->query_read_slave

so perhaps that will work with both versions.