Welcome Guest, Not a member yet? Register   Sign In
vBulletin and CodeIgniter
#1

[eluser]Shinzo[/eluser]
Hello,

i read all old topics in this forum about using codeigniter with vbulletin board, but I found no solution for my problem.

Maybe someone found an solution how to intergrate the $vbulletin->userinfo into codeigniter.

On an other project I include vbulletin with a simple code into a simple PHP-File to use the userinfos like username, posts, email and so on:

Code:
<?php
$curdir = getcwd ();
chdir('forum');
require_once('./global.php');
chdir ($curdir);

echo $vbulletin->userinfo['username']; // Here I can display now my username with i logged in in the forum
?>

If I use now this simple code in a CI-Controller it displays an error:

Fatal error: Call to a member function on a non-object in /root/forum/includes/functions.php on line 1303

But I have no idea where the problem is. I dont want to edit my vBulletin-Script. I only want to use the actually session/cookie infos to work with them in codeigniter.

The was an simple Hook (vBUser.php ?) here in the forum, but the page is down now.

Would be happy about all help.

Thanks, shinzo

Sorry: Can anyone move topic to: "Code and Application Development"
#2

[eluser]Mark LaDoux[/eluser]
I'm working on such a project right now for some friends, I'll be sure to share any code I come up with.
#3

[eluser]Shinzo[/eluser]
That would be great ! Good luck!
#4

[eluser]Mark LaDoux[/eluser]
Oh, here's the vBulletin API doc. http://members.vbulletin.com/api/

Don't worry, it's publically available so you don't need a vBulletin license to view it anymore. It might just be my saviour.
#5

[eluser]missionsix[/eluser]
look for vBuser library here on the forums... i've used it myself which works almost wonderfully.

I've attached my vBuser (slightly modified), for you to take a look at.

Here is an example controller called process that handles Login / Logout.

Code:
<?php

class Process extends Controller {
    function Process() {
        parent::Controller();
    }
    
    function login() {
        
        $username = $this->input->post('username');
        $password = $this->input->post('password');

        if ($userid = $this->vbuser->is_valid_login($username, $password)) {    
            if($this->input->post('cookieuser')) {
                $this->vbuser->create_cookie_user($userid, $password);
            }
            $this->vbuser->create_session($userid);
        }

        redirect('');
    }
    function logout() {
        $this->vbuser->delete_session();
        redirect('');
    }
}

?>
#6

[eluser]Mark LaDoux[/eluser]
thanks much, I've now gotten the client to set up a full vb install on a test host for me

http://test.plotkai.com/ and i'm gonna start attacking it today now that we got payments and everything worked out. I'm starting by trying to reuse the DB config file. I'll be sure to upload my script for you to peruse. I'm making a drop-in portal for their site so that they won't have to do any coding, and will be including complete back ends and everything. I'll be setting up threads on the forums to keep track of my progress and what not.

to see the forums, it will be http://test.plotkai.com/forums

I'll add a link to it later. I just gotta get the .htaccess file done.
#7

[eluser]missionsix[/eluser]
Someone has a question about forum software previously and I also replied about my vBuser class...

http://ellislab.com/forums/viewthread/77130/#386270

for reference.

Good luck!




Of Note:
Quote:One issue I have with vBulletin is that you cannot include the forums/global.php to get more access to vbulletin’s core, because CI removes all GET variables, this makes it impossible for vBulletin to build its core.

This is an issue for me because I need vBSEO links parser, which the system is integrated into vBulletin Core, so basically I have a lot of reverse engineering to do.
#8

[eluser]Mark LaDoux[/eluser]
thanks, I'm also working on integrating with the vB subscriptions system, I'll be sure to share all that code. Because the nature of this site, we wan't to give more privs to people who have donated money, so I'm trying to reuse as much of vB as possible.

Looks like I've got a lot of reverse engineering to do if i want this to work properly.

// oh, I won't be able to share interfaces, but i've secured full ownership of the backend code that give functionality, so you'll have to do your own interfaces.

oh, here's a working database.php that allowed me to use the same database script as vB so i wouldn't have to rewrite it, or even have to know what was in it.

Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS
| -------------------------------------------------------------------
| This file will contain the settings needed to access your database.
|
| For complete instructions please consult the "Database Connection"
| page of the User Guide.
|
| -------------------------------------------------------------------
| EXPLANATION OF VARIABLES
| -------------------------------------------------------------------
|
|    ['hostname'] The hostname of your database server.
|    ['username'] The username used to connect to the database
|    ['password'] The password used to connect to the database
|    ['database'] The name of the database you want to connect to
|    ['dbdriver'] The database type. ie: mysql.  Currently supported:
                 mysql, mysqli, postgre, odbc, mssql, sqlite, oci8
|    ['dbprefix'] You can add an optional prefix, which will be added
|                 to the table name when using the  Active Record class
|    ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
|    ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
|    ['cache_on'] TRUE/FALSE - Enables/disables query caching
|    ['cachedir'] The path to the folder where cache files should be stored
|    ['char_set'] The character set used in communicating with the database
|    ['dbcollat'] The character collation used in communicating with the database
|
| The $active_group variable lets you choose which connection group to
| make active.  By default there is only one group (the "default" group).
|
| The $active_record variables lets you determine whether or not to load
| the active record class
*/

// adjust this to point to relative path of your vB includes/config.php
require_once 'forums/includes/config.php';

$active_group = "default";
$active_record = TRUE;

$db['default']['hostname'] = $config['MasterServer']['servername'];
$db['default']['username'] = $config['MasterServer']['username'];
$db['default']['password'] = $config['MasterServer']['password'];
$db['default']['database'] = $config['Database']['dbname'];
$db['default']['dbdriver'] = $config['Database']['dbtype'];
$db['default']['dbprefix'] = $config['Database']['tableprefix'];
if ($config['MasterServer']['usepconnect'] = 0)
{
  
  $db['default']['pconnect'] = FALSE;
  
}else{
  
  $db['default']['pconnect'] = TRUE;
  
}

$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";


/* End of file database.php */
/* Location: ./system/application/config/database.php */

yes, debugging is on because i'm in my test environment and i want those errors. That will get turned off before i mainline it.
#9

[eluser]missionsix[/eluser]
Neat,

So I take it that this database script uses the db config from vBulletin and allows CI to use it? Or am I off base here...
#10

[eluser]Mark LaDoux[/eluser]
that's exactly it, I'm going to try and do that as much as possible, and reverse engineer where I can't




Theme © iAndrew 2016 - Forum software by © MyBB