Print Thread
Custom Users Online
skpacman
This is the code for the panel you see on the left here on PHP-Fusion USA (Users Online).

All original copyrights are intact, so there's a lot of commented-out stuff. But it works (as you can see).

Just copy the below into a new panel on the left or right side, set applicable options, enable it, and let it do the rest!

Download source  Code

/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2009 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: online_users_panel.php
| Author: Nick Jones (Digitanium)
| Edited for PHP-Fusion USA by skpacman
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }
 
if (dbcount("(online_user)", DB_ONLINE, (iMEMBER ? "online_user='".$userdata['user_id']."'" : "online_user='0' AND online_ip='".USER_IP."'")) == 1) {
   $result = dbquery(
      "UPDATE ".DB_ONLINE." SET online_lastactive='".time()."', online_ip='".USER_IP."'
      WHERE ".(iMEMBER ? "online_user='".$userdata['user_id']."'" : "online_user='0' AND online_ip='".USER_IP."'"));
} else {
   $result = dbquery(
      "INSERT INTO ".DB_ONLINE." (online_user, online_ip, online_ip_type, online_lastactive)
      VALUES ('".(iMEMBER ? $userdata['user_id'] : 0)."', '".USER_IP."', '".USER_IP_TYPE."', '".time()."')");
}
$result = dbquery("DELETE FROM ".DB_ONLINE." WHERE online_lastactive<".(time()-60)."");
 
openside($locale['global_010']);
$result = dbquery(
   "SELECT ton.online_user, tu.user_id, tu.user_name, tu.user_status, tu.user_level FROM ".DB_ONLINE." ton
   LEFT JOIN ".DB_USERS." tu ON ton.online_user=tu.user_id"
);
$guests = 0;
//$members = array();
//$admins = array();
while ($data = dbarray($result)) {
   if ($data['online_user'] == "0") {
      $guests++;
   }
   /*else {
      if ($data['user_level'] < 102){
         $members[] = array($data['user_id'], $data['user_name'], $data['user_status']);
      }
      if ($data['user_level'] > 101){
         $admins[] = array($data['user_id'], $data['user_name'], $data['user_status']);
      }
   }*/
}
echo THEME_BULLET." ".$locale['global_011'].": ".$guests."<br />\n";
/*echo THEME_BULLET." Admin Online: ".count($admins)."<br />\n";
if (count($admins)) {
   $si = 1;
   while (list($key, $admin) = each($admins)) {
      echo "<span class='side'>".profile_link($admin[0], $admin[1], $admin[2])."</span>";
      if ($si != count($admins)) { echo ",\n"; } else { echo "<br />\n"; }
      $si++;
   }
}
echo "<br />".THEME_BULLET." ".$locale['global_012'].": ".count($members)."<br />\n";
if (count($members)) {
   $i = 1;
   while (list($key, $member) = each($members)) {
      echo "<span class='side'>".profile_link($member[0], $member[1], $member[2])."</span>";
      if ($i != count($members)) { echo ",\n"; } else { echo "<br />\n"; }
      $i++;
   }
}*/
echo "\n".THEME_BULLET." ".$locale['global_014'].": ".number_format(dbcount("(user_id)", DB_USERS, "user_status<='1'"))."<br />\n";
if (iADMIN && checkrights("M") && $settings['admin_activation'] == "1") {
   echo "<br />".THEME_BULLET." <a href='".ADMIN."members.php".$aidlink."&amp;status=2' class='side'>".$locale['global_015']."</a>";
   echo ": ".dbcount("(user_id)", DB_USERS, "user_status='2'")."<br />\n";
}
$data = dbarray(dbquery("SELECT user_id, user_name, user_status FROM ".DB_USERS." WHERE user_status='0' ORDER BY user_joined DESC LIMIT 0,1"));
echo "".THEME_BULLET." ".$locale['global_016'].": <span class='side'>".profile_link($data['user_id'], $data['user_name'], $data['user_status'])."</span>\n";
 
//LAST SEEN USERS PANEL ADDITION BY skpacman
 
/*---------------------------------------------------+
| PHP-Fusion 7 Content Management System
+----------------------------------------------------+
| Copyright &#65533; 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Filename: last_seen_users_panel.php
| Author: PHP-Fusion Addons Team
| Edited for PHP-Fusion USA by skpacman
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
 
$locale['lsup000'] = "Last Seen Users";
$locale['lsup001'] = "<span style='color:#2f1;font-weight:bold;'>Online</span>";
$locale['lsup002'] = "<span style='color:#FFD633;'>Idle</span>";
$locale['lsup003'] = "week";
$locale['lsup004'] = "weeks";
$locale['lsup005'] = "day";
$locale['lsup006'] = "days";
$locale['lsup007'] = "Last Seen Admin";
 
echo "<fieldset><legend>".$locale['lsup007'].":</legend>";
 
      $result = dbquery("SELECT
         user_id,
         user_name,
         user_status,
         user_lastvisit
         FROM ".DB_USERS."
         WHERE user_lastvisit >'0'
         AND user_status='0'
         AND user_level>'101'
         ORDER BY user_lastvisit
         DESC LIMIT 0,10
      ");                       
 
         echo "<table cellpadding='0' cellspacing='0' width='100%'>";
         if (dbrows($result) != 0) {
         while ($data = dbarray($result)) {
        $lastseen = time() - $data['user_lastvisit'];
        $iW=sprintf("%2d",floor($lastseen/604800));
        $iD=sprintf("%2d",floor($lastseen/(60*60*24)));
        $iH=sprintf("%02d",floor((($lastseen%604800)%86400)/3600));
        $iM=sprintf("%02d",floor(((($lastseen%604800)%86400)%3600)/60));
        $iS=sprintf("%02d",floor((((($lastseen%604800)%86400)%3600)%60)));
        if ($lastseen < 60){
            $lastseen= $locale['lsup001'];
        } elseif ($lastseen < 360){
            $lastseen= $locale['lsup002'];
        } elseif ($iW > 0){
            if ($iW == 1) { $text = $locale['lsup003']; } else { $text = $locale['lsup004']; }
            $lastseen = $iW." ".$text;
        } elseif ($iD > 0){
            if ($iD == 1) { $text = $locale['lsup005']; } else { $text = $locale['lsup006']; }
            $lastseen = $iD." ".$text;
        } else {
            $lastseen = "<span style='color:#f10;'>".$iH.":".$iM.":".$iS."</span>";
        }
        echo "<tr>\n<td class='side-small' align='left'>".THEME_BULLET."\n";
        echo profile_link($data['user_id'], $data['user_name'], $data['user_status'])."</td><td class='side-small' align='right'>".$lastseen."</td>\n</tr>\n";
    }
}
echo "</table></fieldset>";
 
echo "<fieldset><legend>".$locale['lsup000'].":</legend>";
 
      $result = dbquery("SELECT
         user_id,
         user_name,
         user_status,
         user_lastvisit
         FROM ".DB_USERS."
         WHERE user_lastvisit >'0'
         AND user_status='0'
         AND user_level<'102'
         ORDER BY user_lastvisit
         DESC LIMIT 0,15
      ");                       
 
         echo "<table cellpadding='0' cellspacing='0' width='100%'>";
         if (dbrows($result) != 0) {
         while ($data = dbarray($result)) {
        $lastseen = time() - $data['user_lastvisit'];
        $iW=sprintf("%2d",floor($lastseen/604800));
        $iD=sprintf("%2d",floor($lastseen/(60*60*24)));
        $iH=sprintf("%02d",floor((($lastseen%604800)%86400)/3600));
        $iM=sprintf("%02d",floor(((($lastseen%604800)%86400)%3600)/60));
        $iS=sprintf("%02d",floor((((($lastseen%604800)%86400)%3600)%60)));
        if ($lastseen < 60){
            $lastseen= $locale['lsup001'];
        } elseif ($lastseen < 360){
            $lastseen= $locale['lsup002'];
        } elseif ($iW > 0){
            if ($iW == 1) { $text = $locale['lsup003']; } else { $text = $locale['lsup004']; }
            $lastseen = $iW." ".$text;
        } elseif ($iD > 0){
            if ($iD == 1) { $text = $locale['lsup005']; } else { $text = $locale['lsup006']; }
            $lastseen = $iD." ".$text;
        } else {
            $lastseen = "<span style='color:#f10;'>".$iH.":".$iM.":".$iS."<span>";
        }
        echo "<tr>\n<td class='side-small' align='left'>".THEME_BULLET."\n";
        echo profile_link($data['user_id'], $data['user_name'], $data['user_status'])."</td><td class='side-small' align='right'>".$lastseen."</td>\n</tr>\n";
    }
}
echo "</table></fieldset>";
closeside();



Edited by skpacman on 03-03-2013 07:58


There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
madsen
Thanks, i will try it out when i get home from work Smile
PHP Noob.
 
KasteR
Awesome, works well. Thumb Up Currently using it on my site Smile
 
Hal Ricard
-
the green label (online) is breaking the harmony of the current theme of the site.
maybe the green and the red could have a darker shade and less aggressive. Thumb Up

a suggestion:

Online (#006600)
00:29:30 (#cc0000)

regards,
-
Hal Ricard
Fullname: Halisson Ricardo
PHP-Fusion Senior Developer
NSS Brazil Admin Leader
 
Homdax
See, I am not the only one nitpicking about colours and stuff....!!! Na Na Na nanana

Good call, Hal...
 
skpacman
Adjust colors whatever way you like. Those were just the defaults I threw in there.

Currently, I have mine set to:

Online (#55AA55)
Idle (#FE9A2E )
HH:MM:SS (#C22D2D )
x Days (#000000)

There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
Hal Ricard
-
we are making progress Smile
-
Hal Ricard
Fullname: Halisson Ricardo
PHP-Fusion Senior Developer
NSS Brazil Admin Leader
 
skpacman
Also available at GitHub

There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
hervan
good thenk's Thumb Up
 
spunk
Thanks skpacman! Amazing work!

How can i get a small icon user_gender from user_field behind usernames?
 
skpacman

>spunk wrote:


Thanks skpacman! Amazing work!

How can i get a small icon user_gender from user_field behind usernames?


Try this:

The below may, or may not, work. I don't know what's stored in the db field so I'm just pulling whatever's in that field and displaying it in text. If I knew more about the user field you're using for gender, I could make this more complete.

Download source  Code
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2009 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: online_users_panel.php
| Author: Nick Jones (Digitanium)
| Edited for PHP-Fusion USA by skpacman
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }
 
if (dbcount("(online_user)", DB_ONLINE, (iMEMBER ? "online_user='".$userdata['user_id']."'" : "online_user='0' AND online_ip='".USER_IP."'")) == 1) {
   $result = dbquery(
      "UPDATE ".DB_ONLINE." SET online_lastactive='".time()."', online_ip='".USER_IP."'
      WHERE ".(iMEMBER ? "online_user='".$userdata['user_id']."'" : "online_user='0' AND online_ip='".USER_IP."'"));
} else {
   $result = dbquery(
      "INSERT INTO ".DB_ONLINE." (online_user, online_ip, online_ip_type, online_lastactive)
      VALUES ('".(iMEMBER ? $userdata['user_id'] : 0)."', '".USER_IP."', '".USER_IP_TYPE."', '".time()."')");
}
$result = dbquery("DELETE FROM ".DB_ONLINE." WHERE online_lastactive<".(time()-60)."");
 
openside($locale['global_010']);
$result = dbquery(
   "SELECT ton.online_user, tu.user_id, tu.user_name, tu.user_status, tu.user_level FROM ".DB_ONLINE." ton
   LEFT JOIN ".DB_USERS." tu ON ton.online_user=tu.user_id"
);
$guests = 0;
//$members = array();
//$admins = array();
while ($data = dbarray($result)) {
   if ($data['online_user'] == "0") {
      $guests++;
   }
   /*else {
      if ($data['user_level'] < 102){
         $members[] = array($data['user_id'], $data['user_name'], $data['user_status']);
      }
      if ($data['user_level'] > 101){
         $admins[] = array($data['user_id'], $data['user_name'], $data['user_status']);
      }
   }*/
}
echo THEME_BULLET." ".$locale['global_011'].": ".$guests."<br />\n";
/*echo THEME_BULLET." Admin Online: ".count($admins)."<br />\n";
if (count($admins)) {
   $si = 1;
   while (list($key, $admin) = each($admins)) {
      echo "<span class='side'>".profile_link($admin[0], $admin[1], $admin[2])."</span>";
      if ($si != count($admins)) { echo ",\n"; } else { echo "<br />\n"; }
      $si++;
   }
}
echo "<br />".THEME_BULLET." ".$locale['global_012'].": ".count($members)."<br />\n";
if (count($members)) {
   $i = 1;
   while (list($key, $member) = each($members)) {
      echo "<span class='side'>".profile_link($member[0], $member[1], $member[2])."</span>";
      if ($i != count($members)) { echo ",\n"; } else { echo "<br />\n"; }
      $i++;
   }
}*/
echo "\n".THEME_BULLET." ".$locale['global_014'].": ".number_format(dbcount("(user_id)", DB_USERS, "user_status<='1'"))."<br />\n";
if (iADMIN && checkrights("M") && $settings['admin_activation'] == "1") {
   echo "<br />".THEME_BULLET." <a href='".ADMIN."members.php".$aidlink."&amp;status=2' class='side'>".$locale['global_015']."</a>";
   echo ": ".dbcount("(user_id)", DB_USERS, "user_status='2'")."<br />\n";
}
$data = dbarray(dbquery("SELECT user_id, user_name, user_status FROM ".DB_USERS." WHERE user_status='0' ORDER BY user_joined DESC LIMIT 0,1"));
echo "".THEME_BULLET." ".$locale['global_016'].": <span class='side'>".profile_link($data['user_id'], $data['user_name'], $data['user_status'])."</span>\n";
 
//LAST SEEN USERS PANEL ADDITION BY skpacman
 
/*---------------------------------------------------+
| PHP-Fusion 7 Content Management System
+----------------------------------------------------+
| Copyright &#65533; 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Filename: last_seen_users_panel.php
| Author: PHP-Fusion Addons Team
| Edited for PHP-Fusion USA by skpacman
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
 
$locale['lsup000'] = "Last Seen Users";
$locale['lsup001'] = "<span style='color:#2f1;font-weight:bold;'>Online</span>";
$locale['lsup002'] = "<span style='color:#FFD633;'>Idle</span>";
$locale['lsup003'] = "week";
$locale['lsup004'] = "weeks";
$locale['lsup005'] = "day";
$locale['lsup006'] = "days";
$locale['lsup007'] = "Last Seen Admin";
 
echo "<fieldset><legend>".$locale['lsup007'].":</legend>";
 
      $result = dbquery("SELECT
         user_id,
         user_name,
         user_status,
         user_lastvisit,
       user_gender
         FROM ".DB_USERS."
         WHERE user_lastvisit >'0'
         AND user_status='0'
         AND user_level>'101'
         ORDER BY user_lastvisit
         DESC LIMIT 0,10
      ");                       
 
         echo "<table cellpadding='0' cellspacing='0' width='100%'>";
         if (dbrows($result) != 0) {
         while ($data = dbarray($result)) {
        $lastseen = time() - $data['user_lastvisit'];
        $iW=sprintf("%2d",floor($lastseen/604800));
        $iD=sprintf("%2d",floor($lastseen/(60*60*24)));
        $iH=sprintf("%02d",floor((($lastseen%604800)%86400)/3600));
        $iM=sprintf("%02d",floor(((($lastseen%604800)%86400)%3600)/60));
        $iS=sprintf("%02d",floor((((($lastseen%604800)%86400)%3600)%60)));
        if ($lastseen < 60){
            $lastseen= $locale['lsup001'];
        } elseif ($lastseen < 360){
            $lastseen= $locale['lsup002'];
        } elseif ($iW > 0){
            if ($iW == 1) { $text = $locale['lsup003']; } else { $text = $locale['lsup004']; }
            $lastseen = $iW." ".$text;
        } elseif ($iD > 0){
            if ($iD == 1) { $text = $locale['lsup005']; } else { $text = $locale['lsup006']; }
            $lastseen = $iD." ".$text;
        } else {
            $lastseen = "<span style='color:#f10;'>".$iH.":".$iM.":".$iS."</span>";
        }
        echo "<tr>\n<td class='side-small' align='left'>".THEME_BULLET."\n";
        echo profile_link($data['user_id'], $data['user_name'], $data['user_status'])." ".$data['user_gender']."</td><td class='side-small' align='right'>".$lastseen."</td>\n</tr>\n";
    }
}
echo "</table></fieldset>";
 
echo "<fieldset><legend>".$locale['lsup000'].":</legend>";
 
      $result = dbquery("SELECT
         user_id,
         user_name,
         user_status,
         user_lastvisit,
       user_gender
         FROM ".DB_USERS."
         WHERE user_lastvisit >'0'
         AND user_status='0'
         AND user_level<'102'
         ORDER BY user_lastvisit
         DESC LIMIT 0,15
      ");                       
 
         echo "<table cellpadding='0' cellspacing='0' width='100%'>";
         if (dbrows($result) != 0) {
         while ($data = dbarray($result)) {
        $lastseen = time() - $data['user_lastvisit'];
        $iW=sprintf("%2d",floor($lastseen/604800));
        $iD=sprintf("%2d",floor($lastseen/(60*60*24)));
        $iH=sprintf("%02d",floor((($lastseen%604800)%86400)/3600));
        $iM=sprintf("%02d",floor(((($lastseen%604800)%86400)%3600)/60));
        $iS=sprintf("%02d",floor((((($lastseen%604800)%86400)%3600)%60)));
        if ($lastseen < 60){
            $lastseen= $locale['lsup001'];
        } elseif ($lastseen < 360){
            $lastseen= $locale['lsup002'];
        } elseif ($iW > 0){
            if ($iW == 1) { $text = $locale['lsup003']; } else { $text = $locale['lsup004']; }
            $lastseen = $iW." ".$text;
        } elseif ($iD > 0){
            if ($iD == 1) { $text = $locale['lsup005']; } else { $text = $locale['lsup006']; }
            $lastseen = $iD." ".$text;
        } else {
            $lastseen = "<span style='color:#f10;'>".$iH.":".$iM.":".$iS."<span>";
        }
        echo "<tr>\n<td class='side-small' align='left'>".THEME_BULLET."\n";
        echo profile_link($data['user_id'], $data['user_name'], $data['user_status'])." ".$data['user_gender']."</td><td class='side-small' align='right'>".$lastseen."</td>\n</tr>\n";
    }
}
echo "</table></fieldset>";
closeside();
?>



Edited by skpacman on 07-29-2013 10:58


There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
spunk
Thanks for your thought! Thumb Up

It is now running (with images, view only for members) on my website Yay
 
MarioMP24
Hello, I wanted to ask how I can do that I'm not the administrator will receive a special user group?

Greetings MarioMP24
 
skpacman

>MarioMP24 wrote:


Hello, I wanted to ask how I can do that I'm not the administrator will receive a special user group?

Greetings MarioMP24


You want to create another section for a special user group? That's not hard. What's the usergroup's number you want to make another section for?

EDIT:

Try the below code. Near the top of the code, there are a few variables you can change.
Download source  Code
$enable_group = true;  //Enable/Disable custom group display
$group_number = "1";  //The usergroup's number to display
$group_lines = 10;  //The number of users to display from that group
$enable_others = true;  //Enable/Disable the original "users" display. Displays all users not in the above group. If groups disabled, shows all members not an admin
$others_lines = 10; //The number of users to display




Follow the previous instructions. Paste the below code into a panel and enable the panel.

Full code:
Download source  Code
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2009 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: online_users_panel.php
| Author: Nick Jones (Digitanium)
| Edited for PHP-Fusion USA by skpacman
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }

/* EDIT THESE VARIABLES TO CHANGE THE PANEL */
$enable_group = true;  //Enable/Disable custom group display
$group_number = "1";  //The usergroup's number to display
$group_lines = 10;  //The number of users to display from that group
$enable_others = true;  //Enable/Disable the original "users" display. Displays all users not in the above group. If groups disabled, shows all members not an admin
$others_lines = 10; //The number of users to display
/* EDIT THESE VARIABLES TO CHANGE THE PANEL */
 
if (dbcount("(online_user)", DB_ONLINE, (iMEMBER ? "online_user='".$userdata['user_id']."'" : "online_user='0' AND online_ip='".USER_IP."'")) == 1) {
   $result = dbquery(
      "UPDATE ".DB_ONLINE." SET online_lastactive='".time()."', online_ip='".USER_IP."'
      WHERE ".(iMEMBER ? "online_user='".$userdata['user_id']."'" : "online_user='0' AND online_ip='".USER_IP."'"));
} else {
   $result = dbquery(
      "INSERT INTO ".DB_ONLINE." (online_user, online_ip, online_ip_type, online_lastactive)
      VALUES ('".(iMEMBER ? $userdata['user_id'] : 0)."', '".USER_IP."', '".USER_IP_TYPE."', '".time()."')");
}
$result = dbquery("DELETE FROM ".DB_ONLINE." WHERE online_lastactive<".(time()-60)."");
 
openside($locale['global_010']);
$result = dbquery(
   "SELECT ton.online_user, tu.user_id, tu.user_name, tu.user_status, tu.user_level FROM ".DB_ONLINE." ton
   LEFT JOIN ".DB_USERS." tu ON ton.online_user=tu.user_id"
);
$guests = 0;
while ($data = dbarray($result)) {
   if ($data['online_user'] == "0") {
      $guests++;
   }
}
echo THEME_BULLET." ".$locale['global_011'].": ".$guests."<br />\n";
echo "\n".THEME_BULLET." ".$locale['global_014'].": ".number_format(dbcount("(user_id)", DB_USERS, "user_status<='1'"))."<br />\n";
if (iADMIN && checkrights("M") && $settings['admin_activation'] == "1") {
   echo "<br />".THEME_BULLET." <a href='".ADMIN."members.php".$aidlink."&amp;status=2' class='side'>".$locale['global_015']."</a>";
   echo ": ".dbcount("(user_id)", DB_USERS, "user_status='2'")."<br />\n";
}
$data = dbarray(dbquery("SELECT user_id, user_name, user_status FROM ".DB_USERS." WHERE user_status='0' ORDER BY user_joined DESC LIMIT 0,1"));
echo "".THEME_BULLET." ".$locale['global_016'].": <span class='side'>".profile_link($data['user_id'], $data['user_name'], $data['user_status'])."</span>\n";
 
$locale['lsup000'] = "Last Seen Users";
$locale['lsup001'] = "<span style='color:#2f1;font-weight:bold;'>Online</span>";
$locale['lsup002'] = "<span style='color:#FFD633;'>Idle</span>";
$locale['lsup003'] = "week";
$locale['lsup004'] = "weeks";
$locale['lsup005'] = "day";
$locale['lsup006'] = "days";
$locale['lsup007'] = "Last Seen Admin";
 
echo "<fieldset><legend>".$locale['lsup007'].":</legend>";
 
      $result = dbquery("SELECT
         user_id,
         user_name,
         user_status,
         user_lastvisit
         FROM ".DB_USERS."
         WHERE user_lastvisit >'0'
         AND user_status='0'
         AND user_level>'101'
         ORDER BY user_lastvisit
         DESC LIMIT 10
      ");                       
 
         echo "<table cellpadding='0' cellspacing='0' width='100%'>";
         if (dbrows($result) != 0) {
         while ($data = dbarray($result)) {
        $lastseen = time() - $data['user_lastvisit'];
        $iW=sprintf("%2d",floor($lastseen/604800));
        $iD=sprintf("%2d",floor($lastseen/(60*60*24)));
        $iH=sprintf("%02d",floor((($lastseen%604800)%86400)/3600));
        $iM=sprintf("%02d",floor(((($lastseen%604800)%86400)%3600)/60));
        $iS=sprintf("%02d",floor((((($lastseen%604800)%86400)%3600)%60)));
        if ($lastseen < 60){
            $lastseen= $locale['lsup001'];
        } elseif ($lastseen < 360){
            $lastseen= $locale['lsup002'];
        } elseif ($iW > 0){
            if ($iW == 1) { $text = $locale['lsup003']; } else { $text = $locale['lsup004']; }
            $lastseen = $iW." ".$text;
        } elseif ($iD > 0){
            if ($iD == 1) { $text = $locale['lsup005']; } else { $text = $locale['lsup006']; }
            $lastseen = $iD." ".$text;
        } else {
            $lastseen = "<span style='color:#f10;'>".$iH.":".$iM.":".$iS."</span>";
        }
        echo "<tr>\n<td class='side-small' align='left'>".THEME_BULLET."\n";
        echo profile_link($data['user_id'], $data['user_name'], $data['user_status'])."</td><td class='side-small' align='right'>".$lastseen."</td>\n</tr>\n";
    }
}
echo "</table></fieldset>";

if ($enable_group){
   $group_name = getgroupname($group_number);
   echo "<fieldset><legend>".$group_name.":</legend>";
   
        $result = dbquery("SELECT
          user_id,
          user_name,
          user_status,
          user_lastvisit
          FROM ".DB_USERS."
          WHERE user_lastvisit >'0'
          AND user_status='0'
          AND user_level<'102'
          AND user_groups LIKE '%.".$group_number."%'
          ORDER BY user_lastvisit
          DESC LIMIT ".$group_lines."
        ");                       
   
          echo "<table cellpadding='0' cellspacing='0' width='100%'>";
          if (dbrows($result) != 0) {
          while ($data = dbarray($result)) {
         $lastseen = time() - $data['user_lastvisit'];
         $iW=sprintf("%2d",floor($lastseen/604800));
         $iD=sprintf("%2d",floor($lastseen/(60*60*24)));
         $iH=sprintf("%02d",floor((($lastseen%604800)%86400)/3600));
         $iM=sprintf("%02d",floor(((($lastseen%604800)%86400)%3600)/60));
         $iS=sprintf("%02d",floor((((($lastseen%604800)%86400)%3600)%60)));
         if ($lastseen < 60){
            $lastseen= $locale['lsup001'];
         } elseif ($lastseen < 360){
            $lastseen= $locale['lsup002'];
         } elseif ($iW > 0){
            if ($iW == 1) { $text = $locale['lsup003']; } else { $text = $locale['lsup004']; }
            $lastseen = $iW." ".$text;
         } elseif ($iD > 0){
            if ($iD == 1) { $text = $locale['lsup005']; } else { $text = $locale['lsup006']; }
            $lastseen = $iD." ".$text;
         } else {
            $lastseen = "<span style='color:#f10;'>".$iH.":".$iM.":".$iS."<span>";
         }
         echo "<tr>\n<td class='side-small' align='left'>".THEME_BULLET."\n";
         echo profile_link($data['user_id'], $data['user_name'], $data['user_status'])."</td><td class='side-small' align='right'>".$lastseen."</td>\n</tr>\n";
      }
   }
   echo "</table></fieldset>";
}

if ($enable_others){
   echo "<fieldset><legend>".$locale['lsup000'].":</legend>";
   
      $query = "SELECT
          user_id,
          user_name,
          user_status,
          user_lastvisit
          FROM ".DB_USERS."
          WHERE user_lastvisit >'0'
          AND user_status='0'
          AND user_level<'102'";
          if ($enable_group){ $query .= "AND NOT user_groups LIKE '%.".$group_number."%'"; }
          $query .= "ORDER BY user_lastvisit
          DESC LIMIT ".$group_lines."";
        $result = dbquery($query);                       
   
          echo "<table cellpadding='0' cellspacing='0' width='100%'>";
          if (dbrows($result) != 0) {
          while ($data = dbarray($result)) {
         $lastseen = time() - $data['user_lastvisit'];
         $iW=sprintf("%2d",floor($lastseen/604800));
         $iD=sprintf("%2d",floor($lastseen/(60*60*24)));
         $iH=sprintf("%02d",floor((($lastseen%604800)%86400)/3600));
         $iM=sprintf("%02d",floor(((($lastseen%604800)%86400)%3600)/60));
         $iS=sprintf("%02d",floor((((($lastseen%604800)%86400)%3600)%60)));
         if ($lastseen < 60){
            $lastseen= $locale['lsup001'];
         } elseif ($lastseen < 360){
            $lastseen= $locale['lsup002'];
         } elseif ($iW > 0){
            if ($iW == 1) { $text = $locale['lsup003']; } else { $text = $locale['lsup004']; }
            $lastseen = $iW." ".$text;
         } elseif ($iD > 0){
            if ($iD == 1) { $text = $locale['lsup005']; } else { $text = $locale['lsup006']; }
            $lastseen = $iD." ".$text;
         } else {
            $lastseen = "<span style='color:#f10;'>".$iH.":".$iM.":".$iS."<span>";
         }
         echo "<tr>\n<td class='side-small' align='left'>".THEME_BULLET."\n";
         echo profile_link($data['user_id'], $data['user_name'], $data['user_status'])."</td><td class='side-small' align='right'>".$lastseen."</td>\n</tr>\n";
      }
   }
   echo "</table></fieldset>";
}

closeside();




Edited by skpacman on 04-17-2014 13:59


There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
MarioMP24
Thanks Thumb Up i will test the same
It works. adjust something and now it shows all users in the group to
Edited by MarioMP24 on 04-17-2014 14:11

 
MarioMP24
Hello how can I enter a letter / character limit in the advertisement? The the user name is limited to a maximum number of characters?
Have it with
. DESC LIMIT 0, "$ settings ['user_name'];

tries.

And the name displayed
. trimlink ($ data ['user_name'], 10),

But that's not really

Greeting MarioMP24
 
skpacman
This is what shows the username link:
Download source  Code
echo profile_link($data['user_id'], $data['user_name'], $data['user_status'])."</td><td class='side-small' align='right'>".$lastseen."</td>\n</tr>\n";




profile_link() function can't really be changed but I can adjust the code to trim the username if you want and not use the profile_link() function.

There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
MarioMP24
yes that would be nice. With a maximum length of 10 characters

Greeting MarioMP24
 
skpacman
Edit your panel code

Replace every single line that has this profile link line (should be 3 in that panel)
Download source  Code
echo profile_link($data['user_id'], $data['user_name'], $data['user_status'])."</td><td class='side-small' align='right'>".$lastseen."</td>\n</tr>\n";




With:
Download source  Code
if (strlen($data['user_name']) > 10){ $data['user_name'] = substr($data['user_name'], 0, 7)."..."; }
echo "<a href='".BASEDIR."profile.php?lookup=".$data['user_id']."' class='profile-link'>".$data['user_name']."</a></td><td class='side-small' align='right'>".$lastseen."</td>\n</tr>\n";




Basically, if the user_name is longer than 10 characters, it cuts it at 7 and appends elipsis "..." at the end of the cut name. (canonical standard)

That should do it. Do you need the full source or do you think you got it covered?

There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
MarioMP24
've adjusted my code a bit. If I then insert their code no longer works the display. : (Can you help me there?
Would be really nice.

Download source  Code
//USER DEVICE
$deviceio1 = "<img src='".INFUSIONS."D1_device_ident_panel/images/".$data['user_device'].".png' alt='Device' width='12' height='12' style='vertical-align: middle;' />&nbsp;";
echo $deviceio1;
//USER DEVICE
         echo profile_link($data['user_id'], $data['user_name'], $data['user_status'])."";
//USER BLOCK S
include INFUSIONS."user_profil_block/infusion_db.php";
$result5 = dbquery("SELECT * FROM ".UPBL." WHERE blocked_user_id='".$userdata['user_id']."' AND user_id='".$data['user_id']."'");
if((dbrows($result5) > 0) && (iMEMBER)) {
echo "<a href='".INFUSIONS."user_profil_block/blocked.php?id=".$data['user_id']."'><img src='".INFUSIONS."D1-Fbchat_panel/images/fbimon.png' title='Facebook Chat mit: ".$data['user_name']."' alt='Facebook Chat mit:&nbsp; ".$data['user_name']."' align='absmiddle' style='vertical-align:middle; margin-left: 2px; border: none;' /></a>";
} else {
//USER BLOCK E
//deeIM
if ((iMEMBER) && ($data['user_id'] != $userdata['user_id'])) {
 $usernamer2 = str_replace(" ", "_", $data['user_name']);
  echo "<a href=\"javascript:void(0)\" onclick=\"javascript:chatWith('".$usernamer2."')\">";
  echo "<img src='".INFUSIONS."D1-Fbchat_panel/images/fbimon.png' title='Facebook Chat mit: ".$usernamer2."' alt='Facebook Chat mit:&nbsp; ".$usernamer2."' align='absmiddle' style='vertical-align:middle; margin-left: 2px; border: none;' />";
  echo "</a>";
}
//deeIM
//USER BLOCK S
}
//USER BLOCK E
echo "</td><td class='side-small' align='right'>".$lastseen."</td>\n</tr>\n";




Greeting MarioMP24
 
Jump to Forum: