TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,966
  • Latest: safir45
Stats
  • Total Posts: 195,993
  • Total Topics: 21,324
  • Online today: 397
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 380
  • Total: 380

Users Logged In Today on TP Stats

Started by weimi, June 23, 2008, 09:25:43 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JPDeni

To not show the hidden members at all, change


echo $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'], $user['is_last'] ? '' : ', ';


to


echo $user['hidden'] ? '' : $user['link'], $user['is_last'] ? '' : ', ';


To not show admins will take more changing of the code.

ZarPrime

Haven't tried JPDeni's edit but if you have your Admins change their profiles to be hidden when online, it may work.  Just a guess though.

ZarPrime

alhaudhie

#22
hope is there a trick to remove all information about hidden username include admin or user can manage member also cant see the hidden users... tq

ZarPrime


JPDeni

I'm with ZP. Not a clue what you mean, Mrcare. The change I posted will remove the hidden user names. Have you tried it?

alhaudhie

Quote from: JPDeni on January 26, 2010, 05:36:31 PM
I'm with ZP. Not a clue what you mean, Mrcare. The change I posted will remove the hidden user names. Have you tried it?
yes.. but it still there.. the membergroup that have the "manage members" permission still can see the italic hidden name. tq

alhaudhie

Quote from: Mrcare on January 27, 2010, 12:25:21 AM
Quote from: JPDeni on January 26, 2010, 05:36:31 PM
I'm with ZP. Not a clue what you mean, Mrcare. The change I posted will remove the hidden user names. Have you tried it?
yes.. but it still there.. the membergroup that have the "Moderate forum members" permission still can see the italic hidden name. tq

JPDeni

Okay. Try this


function ssi_whosOnline_today($output_method = 'echo')
{
   global $txt, $scripturl, $db_prefix, $ID_MEMBER, $user_info, $sourcedir;
   global $modSettings, $settings;
   //global $context;

   // Load the users online right now.
   $result = db_query("
      SELECT
         lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline,
         mg.onlineColor, mg.ID_GROUP
      FROM {$db_prefix}log_online AS lo
         LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
         LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))", __FILE__, __LINE__);

   $return['users'] = array();
   $return['guests'] = 0;
   $return['hidden'] = 0;
   $return['buddies'] = 0;
   $show_buddies = !empty($user_info['buddies']);

   while ($row = mysql_fetch_assoc($result))
   {
      if (!isset($row['realName']))
         $return['guests']++;
      elseif (!empty($row['showOnline']) || allowedTo('moderate_forum'))
      {
         // Some basic color coding...
         if (!empty($row['onlineColor']))
            $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
         else
            $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';

         // Bold any buddies.
         if ($show_buddies && in_array($row['ID_MEMBER'], $user_info['buddies']))
         {
            $return['buddies']++;
            $link = '<b>' . $link . '</b>';
         }
         
         $return['users'][$row['logTime'] . $row['memberName']] = array(
            'id' => $row['ID_MEMBER'],
            'username' => $row['memberName'],
            'name' => $row['realName'],
            'group' => $row['ID_GROUP'],
            'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
            'link' => $link,
            'hidden' => empty($row['showOnline']),
            'is_last' => false,
         );
      }
      else
         $return['hidden']++;
   }
   mysql_free_result($result);

   if (!empty($return['users']))
   {
      krsort($return['users']);
      $userlist = array_keys($return['users']);
      $return['users'][$userlist[count($userlist) - 1]]['is_last'] = true;
   }
   $return['num_users'] = count($return['users']) + $return['hidden'];
   $return['total_users'] = $return['num_users'] + $return['guests'];

   // echo to screen?
   if ($output_method == 'echo')
   {     
      echo '
         <div class="smalltext">';

      echo '
         ', $return['guests'], ' ', $return['guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', $return['num_users'], ' ', $return['num_users'] == 1 ? $txt['user'] : $txt['users'];

      // Hidden users, or buddies?
      if ($return['hidden'] > 0 || $show_buddies)
         echo '
            (' . ($show_buddies ? ($return['buddies'] . ' ' . ($return['buddies'] == 1 ? $txt['buddy'] : $txt['buddies'])) : '') . ($show_buddies && $return['hidden'] ? ', ' : '') . (!$return['hidden'] ? '' : $return['hidden'] . ' ' . $txt['hidden']) . ')';

      echo '<br />';
      foreach ($return['users'] as $user)
         echo $user['hidden'] ? '' : $user['link'], $user['is_last'] ? '' : ', ';

     
      echo'</div><br /><hr>';
   }
     
   // Load the users online today.
   $nowdate = getdate(forum_time(false));
   $midnight = mktime(0, 0, 0, $nowdate['mon'], $nowdate['mday'], $nowdate['year']) - ($modSettings['time_offset'] * 3600);

//   $midnight = strtotime('24 hours ago');
   $s = strpos($user_info['time_format'], '%S') === false ? '' : ':%S';
   if (strpos($user_info['time_format'], '%H') === false && strpos($user_info['time_format'], '%T') === false)
      $time_fmt = '%I:%M' . $s . ' %p';
   else
      $time_fmt = '%H:%M' . $s;

   $result = db_query("
      SELECT
         mem.ID_MEMBER, mem.lastLogin, mem.realName, mem.memberName, mem.showOnline,
         mg.onlineColor, mg.ID_GROUP, mg.groupName
      FROM {$db_prefix}members AS mem
         LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))
      WHERE mem.lastLogin >= $midnight", __FILE__, __LINE__);

   $return['users_online_today'] = array();
   $return['list_users_online_today'] = array();

   while ($row = mysql_fetch_assoc($result))
   {
      $userday = strftime('%d', forum_time(true));
      $loginday = strftime('%d', forum_time(true, $row['lastLogin']));
      $yesterday = $userday == $loginday ? '' : $txt['uot_yesterday'];
   
      $lastLogin = $yesterday . strftime($time_fmt, forum_time(true, $row['lastLogin']));
      $title = (allowedTo('moderate_forum') || !empty($row['showOnline'])) ? ' title="' . $lastLogin . '"' : '';

      // Some basic color coding...
      if (!empty($row['onlineColor']))
         $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '"' . $title . ' style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
      else
         $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '"' . $title . '>' . $row['realName'] . '</a>';

      $is_buddy = in_array($row['ID_MEMBER'], $user_info['buddies']);
      if ($is_buddy)
      {
         $link = '<b>' . $link . '</b>';
      }
           
      $is_online = false;
      if ($return['num_users']>0)
      {
         foreach($return['users'] as $user)
         {
            if ($user['id'] == $row['ID_MEMBER'])
            {
               $is_online = true;
            }
         }
      }
     
      $return['users_online_today'][$row['lastLogin'] . $row['memberName']] = array(
         'id' => $row['ID_MEMBER'],
         'username' => $row['memberName'],
         'name' => $row['realName'],
         'group' => $row['ID_GROUP'],
         'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
         'link' => $link,
         'is_buddy' => $is_buddy,
         'is_online' => $is_online,
         'hidden' => empty($row['showOnline']),
      );

      $return['list_users_online_today'][$row['lastLogin'] . $row['memberName']] = (empty($row['showOnline']) && allowedTo('moderate_forum')) ? '' : $link;
   }
   mysql_free_result($result);

   krsort($return['users_online_today']);
   krsort($return['list_users_online_today']);

   $return['num_users_online_today'] = count($return['users_online_today']);
   
   // echo to screen?
   if ($output_method == 'echo')
   {     
      echo '
         <div class="smalltext">';

      echo $return['num_users_online_today'], ' ', $return['num_users_online_today'] == 1 ? strtolower($txt['user']) : strtolower($txt['users']);

      // Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
      if (!empty($return['users_online_today']))
         echo '
            ', 'online today', ':<br />', implode(', ', $return['list_users_online_today']);

      echo '
            <br />', $return['show_stats'] && !$settings['show_sp1_info'] ? '
            <a href="' . $scripturl . '?action=stats">' . $txt['smf223'] . '</a>' : '', '
         </div>';
   }
   else
      return $return;
}


And then come back and tell us what happened.

alhaudhie

yes.... what i can say is.. very nica job.. tq

but to one more thing is.. in the empty name of the hidden name is is taking place by or show ", , ,"

alhaudhie

Also.. when i try to del/change in  TPBlocks.template
foreach($online['users'] as $user)
{
[b]echo $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];[/b]
echo '<br />';
}
echo '
</div></div>';
}
echo '
</div>';
}


to
[b]echo $user['hidden'] ? '' : $user['link'];[/b]
i will become free/blank row. tq

This website is proudly hosted on Crocweb Cloud Website Hosting.