1
Monika
Yogurt search members
  • 2009/2/4 8:27

  • Monika

  • Not too shy to talk

  • Posts: 103

  • Since: 2008/12/19


Hi, can someone of you please tell me how to add search ONLINE/OFFLINE members in yogurt searchmembers.php ??

I have the online function already, as i can see a member if he is online or not, just wanted to add it to search.

Thanks!!

2
mjoel
Re: Yogurt search members
  • 2009/2/6 12:33

  • mjoel

  • Quite a regular

  • Posts: 325

  • Since: 2006/12/9


ok This is based on these post
Quote:

Make sure you have this code by trabis in root/header.php..you can put it before the file closing tags ?>

$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']);
    }

next open yogurt/searchmembers.php

bfore
include_once XOOPS_ROOT_PATH.'/footer.php';

add this code
$user_online = new XoopsUser($xoopsUser->getVar('uid'));

if (
$user_online->isOnline())

{
    
$xoopsTpl->assign('user_online', true);

}


next open yogurt/templates/yogurt_searchresults.html
serach for
<td class="even"><{$users[i].avatar}></td>

and replace it with this

<td class="even"><{$users[i].avatar}>

<{if 
$user_online == true}>
             <
br />   <span style='color:#ee0000;'>Online</span><br />
<{else}>
        <
br />        <span style='color:#000000;'>Offline</span><br />
<{/if}> 

</
td>

clear cache...wallaaa..

tell me if it works..

3
Monika
Re: Yogurt search members
  • 2009/2/6 19:01

  • Monika

  • Not too shy to talk

  • Posts: 103

  • Since: 2008/12/19


Mjoel thank you for your efforts to help but this not what i meant. I meant in search members criteria we should have the possibility to select Search online or Offline users or both.