Skip to content

Instantly share code, notes, and snippets.

@ir-g
Created November 20, 2015 16:54
Show Gist options
  • Save ir-g/430104ded5672d95010e to your computer and use it in GitHub Desktop.
Save ir-g/430104ded5672d95010e to your computer and use it in GitHub Desktop.
<?php
// Docs are here: http://phpdave.com/MyBBIntegrator/Coding_Help#function_getUser
define('IN_MYBB', NULL);
require_once './forum/global.php'; // Or other path to MyBB global.php.
require_once './class.MyBBIntegrator.php'; // Or other relevant path.
$MyBBI = new MyBBIntegrator($mybb, $db, $cache, $plugins, $lang, $config)l
$user = false;
// getUser(0) gets curent user, any other number gets data about the user with that particular record ID
if($MyBBI->isLoggedIn()) $user = $MyBBI->getUser(0);
echo '<br>';
echo if($MyBBI->isLoggedIn()) ? 'You are logged in' : 'You are not logged in';
echo '<br>';
// Following code shows a short overview of current visitors
$wol = $MyBBI->getWhoIsOnline(true);
echo 'There ';
echo ($wol['count_members'] == 1) ? 'is ' : 'are ';
echo $wol['count_members'].' registered users and '.$wol['count_guests'].' guests on your site<br />';
echo 'Registered users: ';
foreach ($wol['members'] as $member)
{
if ($member_name)
{
echo ', ';
}
$member_name = $member['profilelink'];
echo $member_name;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment