MyBB Community Forums

Full Version: Integrating Username/Uid with Pro Chat
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am attempting to pass MyBB username and uid to pro chat rooms for automatic login.
Any idea where I'm going wrong? Huh

define("IN_MYBB", 1);
require '../forums/global.php';
if($mybb->user['uid'] > 0)
{
    $userid  = $mybb->user['uid'];
    $user = get_user($uid);
    $name = $user['username'];
}

// Enter your CMS Global values below for Pro Chat Rooms

define('C_CUSTOM_USERNAME', $name); // username
define('C_CUSTOM_USERID', $userid); // userid
The variable $uid isn't defined anywhere, so change this line
$user = get_user($uid);
To
$user = get_user($userid);
$userid = $mybb->user['uid'];

Technically it's more inline with MyBB practices to change that line to this:

$uid = intval($mybb->user['uid']);
(2013-02-25, 05:26 PM)labrocca Wrote: [ -> ]$userid = $mybb->user['uid'];

Technically it's more inline with MyBB practices to change that line to this:

$uid = intval($mybb->user['uid']);

That's only if it's user input - if he's using the $mybb->user['uid'] variable, it'll already be sanitized.
Are the above settings the only thing that needs to be done to integrate the two?