30
..its a little bit confusing reading the instruction in this thread
For my and all xoopser future reference and info.........here's what i did in XOOPS 2.42 profile to show online/offline status in user profile
1. open root/header.php..put code below before the closing tag ?>
$online_handler =& xoops_gethandler('online');
mt_srand((double)microtime()*1000000);
// set gc probabillity to 10% for now..
if (mt_rand(1, 100) < 11) {
$online_handler->gc(300);
}
if (is_object($xoopsUser)) {
$uid = $xoopsUser->getVar('uid');
$uname = $xoopsUser->getVar('uname');
} else {
$uid = 0;
$uname = '';
}
if (is_object($xoopsModule)) {
$online_handler->write($uid, $uname, time(), $xoopsModule->getVar('mid'), $_SERVER['REMOTE_ADDR']);
} else {
$online_handler->write($uid, $uname, time(), 0, $_SERVER['REMOTE_ADDR']);
}
2. Open modules/profile/userinfo.php
add this code
$user_online = new XoopsUser($thisUser->getVar('uid'));
if ($user_online->isOnline())
{
$xoopsTpl->assign('user_online', true);
}
before
//User info
$xoopsTpl->assign('uname', $thisUser->getVar('uname'));
3. Open modules/profiles/templates/profile_userinfo.html
add the code below where you want to show it in user profile
<br /><b> Online Status:b> <{if $user_online == true}>
<span style='color:#ee0000;'>Onlinespan><br />
<{else}>
<span style='color:#000000;'>Offlinespan><br />
<{/if}>
4. Clear Cache..Voila