| Re: Poster's status |
| by demian on 2010/1/23 13:08:52 can this be integrate with profile module with preloads? without hacking header and let user decide whether to display his/her online status or not |
| Re: Poster's status |
| by maxxy on 2009/12/29 15:32:22 ..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 ?> le="color: #000000"><?php $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 le="color: #000000"><?php $user_online = new XoopsUser($thisUser->getVar('uid')); if ($user_online->isOnline()) { $xoopsTpl->assign('user_online', true); } before le="color: #000000"><?php //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 le="color: #000000"><?php <br /><b> Online Status:</b> <{if $user_online == true}> <span style='color:#ee0000;'>Online</span><br /> <{else}> <span style='color:#000000;'>Offline</span><br /> <{/if}> 4. Clear Cache..Voila ![]() |
| Re: Poster's status |
| by Monika on 2008/12/25 21:04:49 Ok thanks |
| Re: Poster's status |
| by trabis on 2008/12/25 20:14:23 Quote:
That code must go inside the foreach loop in your template. It works here. |
| Re: Poster's status |
| by Monika on 2008/12/25 18:54:55 Trabis i have added your code to friends.php, and in the template i added this code: le="color: #000000"><?php <{if $friends[i].online==true}> <span style='color:#ee0000 font-weight:bold;'>Online</span><br /> <{else}> <span style='color:#000000;font-weight:bold;'>Offline</span><br /> <{/if}> But it always show me Offline
|