MyBB Community Forums

Full Version: MyBB Integration Not Working?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
I'm using the Integration plugin that's on the phpdave site, I can't seem to get the login function to work, and the cookie path is set to / on the configuration on the MyBB directory, so is there anything missing? I have a normal username and password form, and used the example, so what am I missing?

At the moment I am using the code of,
<?php
define('IN_MYBB', NULL);
global $mybb, $lang, $query, $db, $cache, $plugins, $displaygroupfields;
require_once '../forum/global.php';
require_once '../integrator.php';
$MyBBI = new MyBBIntegrator($mybb, $db, $cache, $plugins, $lang, $config);

$login_status = $MyBBI->login($_POST['username'], $_POST['password']);
if ($login_status == true) echo 'Logged in successfully';
else echo 'The login routine failed';
?>

I get "Logged in successfully", but when I go back to the forum, it still hasn't logged me in.
I still use it with MyBB 1.6.x and this works.
Note: It looks almost the same as yours, you don't need:
global $mybb, $lang, $query, $db, $cache, $plugins, $displaygroupfields;
...that is handled here:
$MyBBI = new MyBBIntegrator($mybb, $db, $cache, $plugins, $lang, $config);


// ...
define('IN_MYBB', 1);
// adjust file paths as needed
require_once './global.php';
require_once 'class.MyBBIntegrator.php';
$MyBBI = new MyBBIntegrator($mybb, $db, $cache, $plugins, $lang, $config); 

// different for yours....
$MyBBI->mybb->input['name']= $name;
$MyBBI->mybb->input['password']= $pass;

$login_status = $MyBBI->login($MyBBI->mybb->input['name'], $MyBBI->mybb->input['password']);
if ($login_status == true) {
// ...
(2012-08-18, 11:28 AM)ChocCookieRaider Wrote: [ -> ]Hi,
I'm using the Integration plugin that's on the phpdave site, I can't seem to get the login function to work, and the cookie path is set to / on the configuration on the MyBB directory, so is there anything missing? I have a normal username and password form, and used the example, so what am I missing?

At the moment I am using the code of,
<?php
define('IN_MYBB', NULL);
global $mybb, $lang, $query, $db, $cache, $plugins, $displaygroupfields;
require_once '../forum/global.php';
require_once '../integrator.php';
$MyBBI = new MyBBIntegrator($mybb, $db, $cache, $plugins, $lang, $config);

$login_status = $MyBBI->login($_POST['username'], $_POST['password']);
if ($login_status == true) echo 'Logged in successfully';
else echo 'The login routine failed';
?>

I get "Logged in successfully", but when I go back to the forum, it still hasn't logged me in.

Are you using the code in a raw php file? Or are you using some kind of cms, e.g Joomla, Wordpress or drupal?

If you are using it in a raw php file, you would not need to set the globals.
(2012-08-19, 03:17 PM)bowkilled Wrote: [ -> ]
(2012-08-18, 11:28 AM)ChocCookieRaider Wrote: [ -> ]Hi,
I'm using the Integration plugin that's on the phpdave site, I can't seem to get the login function to work, and the cookie path is set to / on the configuration on the MyBB directory, so is there anything missing? I have a normal username and password form, and used the example, so what am I missing?

At the moment I am using the code of,
<?php
define('IN_MYBB', NULL);
global $mybb, $lang, $query, $db, $cache, $plugins, $displaygroupfields;
require_once '../forum/global.php';
require_once '../integrator.php';
$MyBBI = new MyBBIntegrator($mybb, $db, $cache, $plugins, $lang, $config);

$login_status = $MyBBI->login($_POST['username'], $_POST['password']);
if ($login_status == true) echo 'Logged in successfully';
else echo 'The login routine failed';
?>

I get "Logged in successfully", but when I go back to the forum, it still hasn't logged me in.

Are you using the code in a raw php file? Or are you using some kind of cms, e.g Joomla, Wordpress or drupal?

If you are using it in a raw php file, you would not need to set the globals.

I am having the exact same problem. The form logs you in yet doesnt log into mybb.

You can visit the site here: www.dotacore.com
The forum is here: www.dotacore.com/forum

username: [email protected]
password: password

I have tried to authenticate it using the class here: http://phpdave.com/MyBBIntegrator/

However it only logs in and doesn't save the state in mybb.

To illustrate this I have included a curl that posts the details to members.php in the forum directory.

my cookie path is set to "/"

define("IN_MYBB", 1);
require 'forum/global.php';
//require_once 'forum/global.php';
require_once 'class.MyBBIntegrator.php';
$MyBBI = new MyBBIntegrator($mybb, $db, $cache, $plugins, $lang, $config);
$forumlog = $MyBBI->isLoggedIn();
$MyBBI->mybb->input['name']= $username;
$MyBBI->mybb->input['password']= $password;
	
}
if ($forumlog==true){
	echo 'true';
} else{
echo 'false';
$logmein = $MyBBI->login($MyBBI->mybb->input['name'], $MyBBI->mybb->input['password']);
if ($logmein == true){
	echo 'Logged in successfully';
}
else echo 'The login routine failed'; 
}

No clue whats wrong but doesnt seem to save that it logs in successfully in the session table..

Nevermind used a different kind of script...
The phpdave.com site seems to be down.
Does anyone know where i can get a copy of mybb integrator?
Can someone package it and send it to bryanforst at gmail dot com ?