View Full Version : Sharing database connections with my plugin?
CompiledMonkey
01-12-2009, 05:10 PM
I'm building a quick plugin that does database connectivity, sends emails, and displays HTML output from the query. I'm wondering if it makes sense to attempt to use the connection information that vBulletin already has. Is this possible to do?
Dismounted
01-13-2009, 04:39 AM
You can use the $vbulletin->db object to do queries.
It is.
Add
require_once('global.php');
to your plugin code (it has to be placed in your root forums root directory, else you will have to change path to global.php file).
Then you will be able to use $vbulletin->db object to perform db activity.
Bellardia
01-13-2009, 01:06 PM
Plugin code isn't executed from a php script somewhere in the directory...
You don't require calling the global script.
Dismounted
01-14-2009, 02:53 AM
It is.
Add
require_once('global.php');
to your plugin code (it has to be placed in your root forums root directory, else you will have to change path to global.php file).
Then you will be able to use $vbulletin->db object to perform db activity.
You do know that the DB object must exist for vBulletin to fetch the plugin, right? :) (No DB connection = no plugins and pretty much everything else.)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.