MyBB Community Forums

Full Version: Integration of myBB with website
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want my website and my mybb board to be connected. I Googled and made the integration, and I'm able to get a username id, as long as I specify their ID, but nothing happens when I'm using the function as explained.
What I'm trying to do is verify a connection of one to the forums, via my website, and then show their name.
Here's my code, as well as my attempts to get a username:

PHP Code:
define('IN_MYBB', NULL);
require_once 'forums/global.php';
require_once 'forums/class.MyBBIntegrator.php';
$MyBBI = new MyBBIntegrator($mybb, $db, $cache, $plugins, $lang, $config); 

$user = get_user($uid);

while ($forum_user = mysqli_fetch_array($user))
{
echo $forum_user['username'];
} 
Quite a bit that doesn't make sense here. You're calling this:

$user = get_user($uid);

Which should give you the user without you needing to do anything else, but $uid isn't defined anywhere.

Then this:

while ($forum_user = mysqli_fetch_array($user))

makes no sense as $user isn't a MySQL query so not sure why you're calling mysqli_fetch_array on it.

All you should need is the get_user() line, but I'm not sure if $uid needs to be passed through or where you'd get it from. I'd suggest reaching out to the MyBB Integrator author for documentation.