Skip to content


Subversion checkout URL

You can clone with
Download ZIP

Vb auth

Derek Jones edited this page · 6 revisions
Clone this wiki locally

Authentication library for CodeIgnited vBulletin extensions

Inspired by Pat Andrew's vBuser_-_vBulletin_based_Auth_Library package

Author: MiklosK


Vb_auth library is useful to create, maintain or utilize user sessions authenticated against pre-installed vBulletin installations in the same domain.

It can be used in situations like this:        // domain root or your CodeIgniter Project    // optional place for your CodeIgniter project root  // your vBulletin installation


Session cookie authorization

Recognizes valid vBulletin session cookies and picks up their corresponding user data from vBulletin's user table.

Permanent cookie authorization

Recognizes valid vBulletin permanent cookies ('remember me') and creates a valid session for the corresponding user.

Session info push

In case of a logged in user, vb_auth sends user activity messages to vBulletin's session table, allowing it to be visible in vB admin panel

Download source:

Vb_auth on github


Step 1.

Drop the project files to their respective folders in your CI project

Step 2.

Edit your config/vb_auth.php by adding the proper vBulletin license info and the location of your installed vBulletin forum:

$config['vb_auth']['vblicense'] = 'YOUR VB LINCESE KEY'; 
$config['vb_auth']['forum_url'] = '';

Step 3.

Edit your config/database.php by adding a secondary database definition like this:

$db['vbulletin']['hostname'] = "localhost";
$db['vbulletin']['username'] = "username";
$db['vbulletin']['password'] = "password";
$db['vbulletin']['database'] = "database";
$db['vbulletin']['dbdriver'] = "mysql";
$db['vbulletin']['dbprefix'] = "vb_";
$db['vbulletin']['pconnect'] = FALSE;           // don't use persistent db connections
$db['vbulletin']['db_debug'] = TRUE;
$db['vbulletin']['cache_on'] = FALSE;
$db['vbulletin']['cachedir'] = "";
$db['vbulletin']['char_set'] = "utf8";
$db['vbulletin']['dbcollat'] = "utf8_general_ci";

Important! Make sure that you reconfigure your default database not to use persistent database connection otherwise CI will not be able to handle this dual DB solution.

Step 4.

Optional, but recommended to autoload vb_auth in your config/autoload.php like this:

$autoload['libraries'] = array('database','vb_auth');

How to use

Once you installed and properly configured vb_auth, you can simply use it anywhere in your application.

vb_auth->is_logged_in() returns true if a valid vB session is detected vb_auth->info contains the data of the current user vb_auth->is_admin() returns true if the current user is a vB admin


In a controller

if( $this->vb_auth->is_logged_in()){
} else {

In a view

$CI =& get_instance();
if ( ! $CI->vb_auth->is_logged_in()) {
} else {
    $data['username']       = $CI->vb_auth->info['username']; 


Something went wrong with that request. Please try again.