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,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,913
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 508
  • Total: 508

[Block] Additional Stats

Started by Lord Anubis, March 31, 2008, 05:44:20 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bluto

Bummer. I can't install it through the package manager.

G6Cad

Quote from: Bluto on August 21, 2008, 03:38:37 AM
Bummer. I can't install it through the package manager.

Did you read the first post ?   Just add the code in a php block, the codesnippets are not made for the package manager.

Bluto

Yes, I understand that. The code works great in a block but for the chat portion to work, you need to have the Flash Chat Integration mod installed. That's the part I can't get through the package manager. I get 3 page installation errors, so it has to be done manually.
So, I do have it working as per the first code snippet, but not the second which includes the chat stats.

Lord Anubis

#23
UPDATED FIRST POST


IchBin

It would be better if you updated the first post. :)

Lord Anubis


Final60


Final60

Quote from: Lord Anubis on March 31, 2008, 07:35:55 PM
Flash Chat users can use this one

Screenshot:





Heya

Could I request that Both the Arcade and the chat be included in the stats section ?

Thanks in advance :)

Lord Anubis

Quote from: Lord Anubis on March 31, 2008, 05:44:20 PM


Flash Chat users and E-Arcade users can use this one
Must have Flash Chat Integration Mod installed and E-Arcade

Screenshot:


Upload chat.png and arcade.png to the root of your forum and use a PHP BLOCK



global $context, $settings, $options, $scripturl, $txt, $user_info, $modSettings;

    $bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet2 = '<img src="'.$settings['images_url'].'/TPdivider2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet3 = '<img src="'.$settings['images_url'].'/TPdivider3.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet4 = '<img src="'.$settings['images_url'].'/tpgoto.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet5 = '<img src="'.$settings['images_url'].'/tpmodule2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
echo'

<div class="smalltext" style="font-family: verdana, arial, sans-serif;">';

       if(isset($context['TPortal']['userbox']['stats']))
   // members stats
            echo '
                 <img src="'.$settings['images_url'].'/icons/members.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=mlist"><b>'.$txt[19].'</b></a>
                 <br />'.$bullet.$txt[488].': ' , isset($modSettings['memberCount']) ? $modSettings['memberCount'] : $modSettings['totalMembers'] , '
                 <br />'.$bullet.$txt['tp-latest']. ': <a href="', $scripturl, '?action=profile;u=', $modSettings['latestMember'], '"><b>', $modSettings['latestRealName'], '</b></a>';
       if(isset($context['TPortal']['userbox']['stats_all']))

global $db_prefix,$modSettings;
$today = strtotime("24 hours ago");
date('j') == 1 ? $thismonth = $today : $thismonth = strtotime(date('F') . ' 1');
date('l') == 'Sunday' ? $thisweek = $today : $thisweek = strtotime('last Sunday');
date('M') == 'January' ? $thisyear = $thismonth : $thisyear = strtotime('January 1');
$query = db_query("SELECT
COUNT(dateRegistered > $thisyear OR NULL) as year,
COUNT(dateRegistered > $thismonth OR NULL) as month,
COUNT(dateRegistered > $thisweek OR NULL) as week,
COUNT(dateRegistered > $today OR NULL) as today
FROM {$db_prefix}members
WHERE is_activated = 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);

settype($row['today'], "integer");
settype($row['week'], "integer");
settype($row['month'], "integer");

echo '<br />',$bullet,'New This Month: ', $row['month'],'<br />';
echo $bullet,'New This Week: ', $row['week'],'<br />';
echo $bullet,'New Today: ', $row['today'];

   // more stats
            echo '
                  <hr /><img src="'.$settings['images_url'].'/icons/info.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=stats"><b>'.$txt['tp-stats'].'</b></a>
                 <br />'.$bullet.$txt[489].': '.$modSettings['totalMessages']. '
  <br />'.$bullet. $txt[490].': '.$modSettings['totalTopics']. '
  <br />'.$bullet.$txt['tp-mostonline-today'].': '.$modSettings['mostOnlineToday'].'
  <br />'.$bullet.$txt['tp-mostonline'].': '.$modSettings['mostOnline'].'<br />
  ('.timeformat($modSettings['mostDate']).')
  ';

       if(isset($context['TPortal']['userbox']['online'])){
   // add online users
            echo '<hr /><img src="'.$settings['images_url'].'/icons/online.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=who"><b>'.$txt[158].'</b></a><br />';

            $online = ssi_whosOnline('array');
   echo $bullet.$txt['tp-users'].': '.$online['num_users'];
   echo '<br />'.$bullet.$txt['tp-guests'].': '.$online['guests'];
  // --- Begin FlashChat Integration ---
   echo '<br />', $bullet, 'In Chat: ', $online['num_chat'];
   // --- End FlashChat Integration ---
   echo '<br />'.$bullet.$txt['tp-total'].': '.$online['total_users'].'<hr />
<div style="width: 100%; ' , $online['num_users']>14 ? 'height: 23ex;overflow: auto;' : '' ,'">';

      foreach($online['users'] as $user){
echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
echo '<br />';
   }
echo '</div>';
      // --- Begin FlashChat Integration ---
echo '
<hr />
<img src="/chat.gif"><a href="'.$scripturl.'?action=chat"><b> Users in Chat</b></a><br />
<div style="width: 100%; ', ($online['num_chat'] > 14 ? 'height: 23ex;overflow: auto;' : ''), '">';
foreach ($online['users_chat'] as $user)
{
echo '
', $bullet2, $user['link'], ' (', (!$user['chat']['room']['public'] ? $txt['fc_private_room'] : $user['chat']['room']['name']), ')
<br />';
}
//   No chat users?
if(empty($online['users_chat']))
   echo '<br />No members in chat';
echo '
</div>';
   // --- End FlashChat Integration ---
         }
echo '</div>';
// add arcade users
echo '<div class="smalltext" style="font-family: verdana, arial, sans-serif;">

           
<hr />
<img src="/arcade.png"><a href="'.$scripturl.'?action=arcade"><b> Users in Arcade</b></a><br />';

 
//added code
  echo' <div style="width: 100%; ' , $online['num_users']>14 ? 'height: 23ex;overflow: auto;' : '' ,'">';
//   Its ok now bullits have flown by stand up again lol
$online = ssi_whosOnline('array');
$arcade_users = array();
foreach($online['users'] as $user)
{
  
   $result = db_query("
      SELECT url
      FROM {$db_prefix}log_online
      WHERE ID_MEMBER = $user[id]",__FILE__, __LINE__);

   $checkit = mysql_fetch_assoc($result);
   $data = @unserialize($checkit['url']);
   if($data['action']=='arcade')
   {
      echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];  echo '<br />';
      $arcade_users[] = $user;
   }
   unset($data);
}

//   No arcade users?
if(empty($arcade_users))
   echo '<br />No members in the arcade';
// end wdmboard_statsonline

echo'</div>
</div>
</div>';



OR

For users that just want to show arcade users and have E-Arcade installed can use this code
(REMEMBER TO STILL UPLOAD THE arcade.png TO THE ROOT OF YOUR FORUM!!!)

Screenshot:



global $context, $settings, $options, $scripturl, $txt, $user_info, $modSettings;

    $bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet2 = '<img src="'.$settings['images_url'].'/TPdivider2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet3 = '<img src="'.$settings['images_url'].'/TPdivider3.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet4 = '<img src="'.$settings['images_url'].'/tpgoto.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$bullet5 = '<img src="'.$settings['images_url'].'/tpmodule2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
echo'

<div class="smalltext" style="font-family: verdana, arial, sans-serif;">';

       if(isset($context['TPortal']['userbox']['stats']))
   // members stats
            echo '
                 <img src="'.$settings['images_url'].'/icons/members.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=mlist"><b>'.$txt[19].'</b></a>
                 <br />'.$bullet.$txt[488].': ' , isset($modSettings['memberCount']) ? $modSettings['memberCount'] : $modSettings['totalMembers'] , '
                 <br />'.$bullet.$txt['tp-latest']. ': <a href="', $scripturl, '?action=profile;u=', $modSettings['latestMember'], '"><b>', $modSettings['latestRealName'], '</b></a>';
       if(isset($context['TPortal']['userbox']['stats_all']))

global $db_prefix,$modSettings;
$today = strtotime("24 hours ago");
date('j') == 1 ? $thismonth = $today : $thismonth = strtotime(date('F') . ' 1');
date('l') == 'Sunday' ? $thisweek = $today : $thisweek = strtotime('last Sunday');
date('M') == 'January' ? $thisyear = $thismonth : $thisyear = strtotime('January 1');
$query = db_query("SELECT
COUNT(dateRegistered > $thisyear OR NULL) as year,
COUNT(dateRegistered > $thismonth OR NULL) as month,
COUNT(dateRegistered > $thisweek OR NULL) as week,
COUNT(dateRegistered > $today OR NULL) as today
FROM {$db_prefix}members
WHERE is_activated = 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);

settype($row['today'], "integer");
settype($row['week'], "integer");
settype($row['month'], "integer");

echo '<br />',$bullet,'New This Month: ', $row['month'],'<br />';
echo $bullet,'New This Week: ', $row['week'],'<br />';
echo $bullet,'New Today: ', $row['today'];

   // more stats
            echo '
                  <hr /><img src="'.$settings['images_url'].'/icons/info.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=stats"><b>'.$txt['tp-stats'].'</b></a>
                 <br />'.$bullet.$txt[489].': '.$modSettings['totalMessages']. '
  <br />'.$bullet. $txt[490].': '.$modSettings['totalTopics']. '
  <br />'.$bullet.$txt['tp-mostonline-today'].': '.$modSettings['mostOnlineToday'].'
  <br />'.$bullet.$txt['tp-mostonline'].': '.$modSettings['mostOnline'].'<br />
  ('.timeformat($modSettings['mostDate']).')
  ';

       if(isset($context['TPortal']['userbox']['online'])){
   // add online users
            echo '<hr /><img src="'.$settings['images_url'].'/icons/online.gif" style="margin: 0;" align="bottom" alt="" />
                 <a href="'.$scripturl.'?action=who"><b>'.$txt[158].'</b></a><br />';

            $online = ssi_whosOnline('array');
   echo $bullet.$txt['tp-users'].': '.$online['num_users'];
   echo '<br />'.$bullet.$txt['tp-guests'].': '.$online['guests'];
  // --- Begin FlashChat Integration ---
   echo '<br />', $bullet, 'In Chat: ', $online['num_chat'];
   // --- End FlashChat Integration ---
   echo '<br />'.$bullet.$txt['tp-total'].': '.$online['total_users'].'<hr />
<div style="width: 100%; ' , $online['num_users']>14 ? 'height: 23ex;overflow: auto;' : '' ,'">';

      foreach($online['users'] as $user){
echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
echo '<br />';
   }
echo '</div>';
    
         }
echo '</div>';
// add arcade users
echo '<div class="smalltext" style="font-family: verdana, arial, sans-serif;">

           
<hr />
<img src="/arcade.png"><a href="'.$scripturl.'?action=arcade"><b> Users in Arcade</b></a><br />';

 
//added code
  echo' <div style="width: 100%; ' , $online['num_users']>14 ? 'height: 23ex;overflow: auto;' : '' ,'">';
//   Its ok now bullits have flown by stand up again lol
$online = ssi_whosOnline('array');
$arcade_users = array();
foreach($online['users'] as $user)
{
  
   $result = db_query("
      SELECT url
      FROM {$db_prefix}log_online
      WHERE ID_MEMBER = $user[id]",__FILE__, __LINE__);

   $checkit = mysql_fetch_assoc($result);
   $data = @unserialize($checkit['url']);
   if($data['action']=='arcade')
   {
      echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];  echo '<br />';
      $arcade_users[] = $user;
   }
   unset($data);
}

//   No arcade users?
if(empty($arcade_users))
   echo '<br />No members in the arcade';
// end wdmboard_statsonline

echo'</div>
</div>
</div>';


Thanks to making this code possible goes out to:
Bloc - Overall  stats template from old versions of TP
JPDeni - New members section
Daniel15 - FlashChat users
WDM2005 - Arcade users

Its on the first post

wyckeddreamz

ok, I've done a search and didn't come up with much, is there any way to show online users for BlueImp's Ajax Chat in a this block? I was thinking of trying to find a code for doing it and just piecing it together with the block code you already supplied, and I am not sure how familiar with the Ajax Chat I use any of you are. Getting support from them is a bit of a pain, sourceforge is a bit if a bear to find any support on so I was hoping maybe someone here would have some ideas. I tried isntalling the Ajaxchat integration mod from SMF, but it won't work with an version past 1.16 (I'm using 1.17, it worked til I upgraded my SMF software) and even then I am not sure how that would help add the online users to the block... like I said, I am no coder by any means, I am just lucky sometimes trying to piece things together. Anyway, thank any of you in advance for your time and consideration, and BTW, I LOVE this enhanced stats block!!!

This website is proudly hosted on Crocweb Cloud Website Hosting.