MyBB Community Forums

Full Version: [F] "Location" on "Who's Online" list not updating
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm currently working on a new MyBBoard based forum. It will be completely Dutch, and the whole Dutch MyBBoard translation team is staff on this new forum Smile.

But i have a problem, which i would like to fix. The "Location" part on the "Who's Online" list (online.php) is not updating. It always says that everyone browsing the forum is on the Main Index. All other features related to online statics and time users spend seem to work ok, just not the location.

I also noticed another odd thing that might have todo with it. When i go to the AdminCP > Maintenance > Cache Manager > mostonline > Rebuild Chache... It always gives this error:
The cache was not able to be rebuilt because the required updated function was not found.

The content of the "mostonline" chache don't seem to change either, it's been stuck at the following for a while now:
Array
(
    [numusers] => 6
    [time] => 1099245897
)

Running MyBulletinBoard v1.00 RC4. There are some mod's and a few bug fixes installed, but i already had this problem before i made my first change in the code.

Anyone has an idea on what the problem might be? Which part of the code takes care of updating the "Location"?
Any news or ideas yet?
It could be one of the modifications you have installed, or could be apart of a different server setup.

The part which updates the location is the who's online query in global.php. Online.php then determines what page it is and gives a friendly name to it.

For some reason it appears the location field in the database is actually "" (blank). This is what makes me suspect one of the above.

Could you upload a file somewhere which shows the phpinfo()?
<?php phpinfo() ?>

Thanks
Cris, i sended you the phpinfo(); as PM. hope it helps. I doubt that any modification to the code caused it, like i said:
Quote:There are some mod's and a few bug fixes installed, but i already had this problem before i made my first change in the code.
For the other having this same problem, Chris PMed me back today and suggested a fix. I must say it works perfect now. The fix is included in quote below.

Chris Boulton Wrote:Hey Menthix,

Thanks for the URL to the PHP info, I believe I have worked out the problem. It's because it's a Windows NT/IIS server, it doesn't like the use of REQUEST_URI. I have made up a work around, which I would like you to test if you don't mind. This work around also includes a new feature for the who's online: the ability to dtermine which post/thread/user a visitor is performing a POST on. This was referred to before as a limitation - how when someone hits the "Post Reply" submit button the online location said "Posting New Reply" and didn't include the thread.

To the bottom of inc/functions.php add this:
function get_current_location()
{
global $_ENV, $_SERVER, $_POST;
if($_SERVER['REQUEST_URI'])
{
$location = $_SERVER['REQUEST_URI'];
}
elseif($ENV_['REQUEST_URI'])
{
$location = $ENV['REQUEST_URI'];
}
else
{
if($_SERVER['PATH_INFO'])
{
$location = $_SERVER['PATH_INFO'];
}
elseif($_ENV['PATH_INFO'])
{
$location = $_SERVER['PATH_INFO'];
}
elseif($_ENV['PHP_SELF'])
{
$location = $_ENV['PHP_SELF'];
}
else
{
$location = $_SERVER['PHP_SELF'];
}
if($_SERVER['QUERY_STRING'])
{
$location .= "?".$_SERVER['QUERY_STRING'];
}
elseif($_ENV['QUERY_STRING'])
{
$location = "?".$_ENV['QUERY_STRING'];
}
}

if($_SERVER['REQUEST_METHOD'] == "POST" || $_ENV['REQUEST_METHOD'] == "POST")
{
if($_POST['action'])
{
$addloc[] = "action=".$_POST['action'];
}
if($_POST['fid'])
{
$addloc[] = "fid=".$_POST['fid'];
}
if($_POST['tid'])
{
$addloc[] = "tid=".$_POST['tid'];
}
if($_POST['pid'])
{
$addloc[] = "pid=".$_POST['pid'];
}
if($_POST['uid'])
{
$addloc[] ="uid=".$_POST['uid'];
}
if($_POST['eid'])
{
$addloc[] = "eid=".$_POST['eid'];
}
if(is_array($addloc))
{
$location .= "?".implode("&", $addloc);
}
}
return $location;
}

In global.php, find this:
$mybb['location'] = $REQUEST_URI;

Replace it with:
$mybb['location'] = get_current_location();

Let me know how it goes!

Thanks again Chris.