*

heebeha

  • **
  • 60
  • Me
online or offline icon to show on small profile
« on: September 10, 2013, 11:25:10 PM »
I am looking to have a gif show if a user is either online or offline in their small profile and full profile.

Anyone know the code I would use to get this to work.  Ex, online.gif and offline.gif.  This gifs will be a round red circle or a round blue circle signifying if the user is offline or online at the time.

Thanks

Re: online or offline icon to show on small profile
« Reply #1 on: September 11, 2013, 06:52:42 PM »
check this folder:

\libs\Smarty\plugins

function.checkuser.php

find:

Code: [Select]
if (isset($online) && $online > 0) {
change the next lines:

Code: [Select]
$returnme='<b><font color="'.$lang['useronlinecolor']['online_now'].'"><img src="../icons/user_online.gif" class="online" alt="" />&nbsp;'.$lang['useronlinetext']['online_now'].'</font></b>';

   } else {

$returnme='<b><font color="'.$lang['useronlinecolor']['notactive'].'"><img src="../icons/user_offline.gif" class="online" alt="" />&nbsp;'.$lang['useronlinetext']['offline_now'].'</font></b>';}

Now everywhere where online or offline is available in the tpl files will show icon and text.

for example: {checkuser userid=$item.ref_userid checkfor='online'} item.ref_userid depends on what file you are in
Kind regards,

Jan Oppeneer
working on template for 2.6 and OsdatePDO

My sites under construction:

www.oudere-homo-mannen.com
www.homosenioren.com
www.hotdatingplanet.eu

Will be testing for Osdater.

*

heebeha

  • **
  • 60
  • Me
Re: online or offline icon to show on small profile
« Reply #2 on: September 13, 2013, 03:09:53 AM »
Thank you,  Can you please advise how much of the code below this line: if (isset($online) && $online > 0) {
I need to paste your code over and what I need to keep.  Maybe you can just tune up the below code for me.  I really appreciate the support. 

      /* Check if the user is online */
         $online=$osDB->getOne('select count(onl.userid) from ! as onl, ! as usr where onl.userid = ? and usr.id = onl.userid and usr.allow_viewonline = ? and onl.lastactivitytime > ? ', array(ONLINE_USERS_TABLE, USER_TABLE, $userid,'1', (time()-120)));
         if (isset($online) && $online > 0) {
            $returnme='<b><font color="'.$lang['useronlinecolor']['online_now'].'">'.$lang['useronlinetext']['online_now'].'</font></b>';
         } else {
         $lastvisit = $osDB->getOne('select lastvisit from ! where id = ?', array(USER_TABLE, $userid) );
         if (!isset($lastvisit) ) $lastvisit = time() - 3456000; /* 4-0 days back */
         $time_now = time();
         if ($lastvisit > ($time_now-86400) ) {
            /* Active in last 24 hours */
               $returnme='<b><font color="'.$lang['useronlinecolor']['active_24hours'].'">'.$lang['useronlinetext']['active_24hours'].'</font></b>';
         } elseif ($lastvisit > ($time_now-259200) ) {
            /* Active in last 3 days */
               $returnme='<b><font color="'.$lang['useronlinecolor']['active_3days'].'">'.$lang['useronlinetext']['active_3days'].'</font></b>';
         } elseif ($lastvisit > ($time_now-604800) ) {
            /* Active in last 7 days */
               $returnme='<b><font color="'.$lang['useronlinecolor']['active_1week'].'">'.$lang['useronlinetext']['active_1week'].'</font></b>';
         } elseif ($lastvisit > ($time_now-2592000) ) {
            /* Active in last 30 days */
               $returnme='<b><font color="'.$lang['useronlinecolor']['active_1month'].'">'.$lang['useronlinetext']['active_1month'].'</font></b>';
         } else {
               $returnme='<b><font color="'.$lang['useronlinecolor']['notactive'].'">'.$lang['useronlinetext']['notactive'].'</font></b>';
         }
         }
      } elseif ($checkfor == 'buddy' or $checkfor == 'ban' or $checkfor == 'hot') {
      /* Check if the user is in the buddy list */

Re: online or offline icon to show on small profile
« Reply #3 on: September 13, 2013, 08:34:14 AM »
Most of those lines I don't use. I only show online or offline on the page.

So depending on what you want to keep you have to change the returnme statements and add the gif image and space

<img src="../icons/user_online.gif" class="online" alt="" />&nbsp;'. and make sure the " " and ' ' are on the same place as in mine.
Kind regards,

Jan Oppeneer
working on template for 2.6 and OsdatePDO

My sites under construction:

www.oudere-homo-mannen.com
www.homosenioren.com
www.hotdatingplanet.eu

Will be testing for Osdater.

*

heebeha

  • **
  • 60
  • Me
Re: online or offline icon to show on small profile
« Reply #4 on: September 14, 2013, 06:37:41 PM »
Anyway you can send me back the exact code I would need to use there for just the images to show for on or offline?
The code above is what shows currently for me

Ive tried several times and it wont work correctly for me.

Re: online or offline icon to show on small profile
« Reply #5 on: September 14, 2013, 07:17:43 PM »
replace:

Code: [Select]
[if ($checkfor == 'online') {
/* Check if the user is online */
    $online=$osDB->getOne('select count(onl.userid) from ! as onl, ! as usr where onl.userid = ? and usr.id = onl.userid and usr.allow_viewonline = ? and onl.lastactivitytime > ? ', array(ONLINE_USERS_TABLE, USER_TABLE, $userid,'1', (time()-120)));
    if (isset($online) && $online > 0) {
    $returnme='<b><font color="'.$lang['useronlinecolor']['online_now'].'">'.$lang['useronlinetext']['online_now'].'</font></b>';
    } else {
$lastvisit = $osDB->getOne('select lastvisit from ! where id = ?', array(USER_TABLE, $userid) );
if (!isset($lastvisit) ) $lastvisit = time() - 3456000; /* 4-0 days back */
$time_now = time();
if ($lastvisit > ($time_now-86400) ) {
/* Active in last 24 hours */
    $returnme='<b><font color="'.$lang['useronlinecolor']['active_24hours'].'">'.$lang['useronlinetext']['active_24hours'].'</font></b>';
} elseif ($lastvisit > ($time_now-259200) ) {
/* Active in last 3 days */
    $returnme='<b><font color="'.$lang['useronlinecolor']['active_3days'].'">'.$lang['useronlinetext']['active_3days'].'</font></b>';
} elseif ($lastvisit > ($time_now-604800) ) {
/* Active in last 7 days */
    $returnme='<b><font color="'.$lang['useronlinecolor']['active_1week'].'">'.$lang['useronlinetext']['active_1week'].'</font></b>';
} elseif ($lastvisit > ($time_now-2592000) ) {
/* Active in last 30 days */
    $returnme='<b><font color="'.$lang['useronlinecolor']['active_1month'].'">'.$lang['useronlinetext']['active_1month'].'</font></b>';
} else {
    $returnme='<b><font color="'.$lang['useronlinecolor']['notactive'].'">'.$lang['useronlinetext']['notactive'].'</font></b>';
}
    }

with:

Code: [Select]
if ($checkfor == 'online') {

/* Check if the user is online */

    $online=$osDB->getOne('select count(onl.userid) from ! as onl, ! as usr where onl.userid = ? and usr.id = onl.userid and usr.allow_viewonline = ?', array(ONLINE_USERS_TABLE, USER_TABLE, $userid,'1'));

    if (isset($online) && $online > 0) {

    $returnme='<b><font color="'.$lang['useronlinecolor']['online_now'].'"><img src="../icons/user_online.gif" class="online" alt="" />&nbsp;'.$lang['useronlinetext']['online_now'].'</font></b>';

    } else {

    $returnme='<b><font color="'.$lang['useronlinecolor']['notactive'].'"><img src="../icons/user_offline.gif" class="online" alt="" />&nbsp;'.$lang['useronlinetext']['offline_now'].'</font></b>';

}[code]
Kind regards,

Jan Oppeneer
working on template for 2.6 and OsdatePDO

My sites under construction:

www.oudere-homo-mannen.com
www.homosenioren.com
www.hotdatingplanet.eu

Will be testing for Osdater.

*

heebeha

  • **
  • 60
  • Me
Re: online or offline icon to show on small profile
« Reply #6 on: September 17, 2013, 05:52:49 PM »
Awesome help.  Worked perfect.  Thank you