PDA

View Full Version : How can I use $vbulletin->db methods without globalizing $vbulletin?


zylstra
11-08-2013, 02:10 AM
How can I use $vbulletin->db methods, like query_read(), without globalizing $vbulletin and requiring global.php in my plugin that uses those methods?

I can access userinfo and a whole bunch of other variables by using $this->registry->[...], but $this doesn't appear to contain $vbulletin->db.

nerbert
11-08-2013, 02:33 AM
Have you tried $this->registry->db?

tbworld
11-08-2013, 02:54 AM
If you are using a hook to execute your code, then what hook are you invoking the method from. We can then give you a better answer.

zylstra
11-08-2013, 06:28 AM
Wow, my brain must have been a little fried. Yes, $this->registry->db worked.

Thanks, nerbert and tbworld.