2011-08-02, 01:39 PM
Pages: 1 2
2011-08-02, 06:43 PM
Where is your page located ? If it is outside the forum's folder then there would be index.php file path's issue.
2011-08-03, 12:20 AM
The page is located at example.com/index.php and the forum is located at example.com/topics/index.php
2011-08-03, 12:22 AM
Try this;
Change http://example.com/topics/ to the correct forum's path.
<?php
define("IN_MYBB", 1);
require_once ('http://example.com/topics/global.php');
require_once ('http://example.com/topics/index.php');
echo $whosonline;
?>
Change http://example.com/topics/ to the correct forum's path.
2011-08-03, 08:31 AM
Ok, tried that, I just get a blank page.
2011-08-03, 08:36 AM
(2011-08-03, 12:22 AM)Yaldaram Wrote: [ -> ]Try this;
<?php define("IN_MYBB", 1); require_once ('http://example.com/topics/global.php'); require_once ('http://example.com/topics/index.php'); echo $whosonline; ?>
Change http://example.com/topics/ to the correct forum's path.
Erm, that wouldn't work.
You could just take the who's online code from index.php and put it in your custom page.
2011-08-03, 08:39 AM
Would it be this?
OR
// Build the who's online bit on the index page.
$onlinecount = $membercount + $guestcount + $botcount;
if($onlinecount != 1)
{
$onlinebit = $lang->online_online_plural;
}
else
{
$onlinebit = $lang->online_online_singular;
}
if($membercount != 1)
{
$memberbit = $lang->online_member_plural;
}
else
{
$memberbit = $lang->online_member_singular;
}
if($anoncount != 1)
{
$anonbit = $lang->online_anon_plural;
}
else
{
$anonbit = $lang->online_anon_singular;
}
if($guestcount != 1)
{
$guestbit = $lang->online_guest_plural;
}
else
{
$guestbit = $lang->online_guest_singular;
}
$lang->online_note = $lang->sprintf($lang->online_note, my_number_format($onlinecount), $onlinebit, $mybb->settings['wolcutoffmins'], my_number_format($membercount), $memberbit, my_number_format($anoncount), $anonbit, my_number_format($guestcount), $guestbit);
eval("\$whosonline = \"".$templates->get("index_whosonline")."\";");
}
OR
// Get the online users.
$timesearch = TIME_NOW - $mybb->settings['wolcutoff'];
$comma = '';
$query = $db->query("
SELECT s.sid, s.ip, s.uid, s.time, s.location, s.location1, u.username, u.invisible, u.usergroup, u.displaygroup
FROM ".TABLE_PREFIX."sessions s
LEFT JOIN ".TABLE_PREFIX."users u ON (s.uid=u.uid)
WHERE s.time>'$timesearch'
ORDER BY u.username ASC, s.time DESC
");
$forum_viewers = array();
$membercount = 0;
$onlinemembers = '';
$guestcount = 0;
$anoncount = 0;
$doneusers = array();
Pages: 1 2