TinyPortal

Development => Block Codes => Topic started by: Lord Anubis on March 31, 2008, 05:44:20 PM

Title: [Block] Additional Stats
Post by: Lord Anubis on March 31, 2008, 05:44:20 PM
Info:

Creates a Stats Block with much more information

Screenshot:

OLD
NEW
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Ftinyadminresources.com%2Fextras%2Fimagehost%2Fscript%2Fuploads%2F11dc58ff67.jpg&hash=0ba21db5426f032ed739e08065e1d7e83e4a83e5)(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Ftinyadminresources.com%2Fextras%2Fimagehost%2Fscript%2Fuploads%2F7395bed8a8.jpg&hash=3dd0ce9b43720cae8af0dacba0568d60631dfbf5)

This code will add New Members from
to the Members section of the stats block

In a PHP block add this code

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'];
   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>

</div>';


Flash Chat users and E-Arcade users can use this one
Must have Flash Chat Integration Mod installed and E-Arcade (http://www.ericsworld.eu/f2/index.php)

Screenshot:
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fnextsite.org%2Fforum%2Fimagehost%2Fuploads%2Fe983337e6e.png&hash=40f9c5f57bd639cdca8877e50056936d833e5b3a)

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 (http://www.ericsworld.eu/f2/index.php) installed can use this code
(REMEMBER TO STILL UPLOAD THE arcade.png TO THE ROOT OF YOUR FORUM!!!)

Screenshot:

(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fnextsite.org%2Fforum%2Fimagehost%2Fuploads%2F4d88668e36.png&hash=52543082a662d0c4c3283fc0a00ff046cf10cecf)

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 (http://www.tinyportal.co.uk) - Overall  stats template from old versions of TP
JPDeni (http://www.morethanspike.com/) - New members section
Daniel15 (http://www.daniel15.com/forum/index.php) - FlashChat users
WDM2005 (http://sleepy-arcade.ath.cx/dev/) - Arcade users
Title: Re: Additional Stats
Post by: Lord Anubis on March 31, 2008, 07:35:55 PM
Flash Chat users can use this one

Screenshot:


(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Ftinyadminresources.com%2Fextras%2Fimagehost%2Fscript%2Fuploads%2F93f4d43abd.jpg&hash=59e8d1598d3b93f928e33587b7d9641b58e8c523)

What you need to do download the chat.png at the bottom of this post and upload it to the root of your site.

then in a php block add this code

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.png"><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 />';
}
echo '
</div>';
   // --- End FlashChat Integration ---
         }
echo '</div>

</div>';
Title: Re: Additional Stats
Post by: RoarinRow on March 31, 2008, 08:02:30 PM
Very cool, thanks!!   8)
Title: Re: Additional Stats
Post by: Lord Anubis on April 01, 2008, 12:41:45 AM
Your welcome they are both built off of code that is on here, just modified a bit :)
Title: Re: Additional Stats
Post by: Smoky on April 01, 2008, 05:56:18 AM
neat m'lord  :coolsmiley: :buck2:
Title: Re: Additional Stats
Post by: Rafferty on April 02, 2008, 02:45:21 PM
Database Error
Title: Re: Additional Stats
Post by: Lord Anubis on April 02, 2008, 02:56:38 PM
Well that tells me alot...I have tested this on 3 forums so I think you might not have copied and pasted the whole thing
Title: Re: Additional Stats
Post by: Rafferty on April 02, 2008, 03:01:40 PM
Sorry, I dont know what Im talking about most the time LoL.

This is the error I get:

Table 'xxxxxx.members' doesn't exist
File: /home/www/xxxxxxxx/forum/Sources/Load.php(1901) : eval()'d code(35) : eval()'d code
Line: 32
Title: Re: Additional Stats
Post by: Lord Anubis on April 02, 2008, 03:11:40 PM
Did you copy the entire code and put it in a PHP block?
Title: Re: Additional Stats
Post by: platinumUWE on April 02, 2008, 11:01:08 PM
ty very much very cool great job  ;)
Title: Re: Additional Stats
Post by: Rafferty on April 03, 2008, 12:18:18 AM
QuoteDid you copy the entire code and put it in a PHP block?

Yes its all there and PHP
Title: Re: Additional Stats
Post by: Lord Anubis on April 03, 2008, 12:26:40 AM
HMMM I need more info
Title: Re: Additional Stats
Post by: b33znutz on June 05, 2008, 01:02:12 PM
works great! thanks!
Title: Re: Additional Stats
Post by: wdm2005 on August 12, 2008, 09:54:45 AM
and chance of getting spiders showing in this? please

nevermind figard it out
Title: Re: Additional Stats
Post by: Ferretness on August 20, 2008, 07:19:19 PM
what is fast chat and where can I get it (yes I tried search)
Title: Re: Additional Stats
Post by: Ken. on August 20, 2008, 07:30:35 PM
Welcome to TinyPortal Ferretness. :)

The chat that Lord Anubis mentioned is 'Flash Chat' not 'fast chat'.

Here's a Google Search. (http://www.google.com/search?client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&channel=s&hl=en&q=+%27Flash+Chat%27&btnG=Google+Search)
Title: Re: Additional Stats
Post by: Ferretness on August 20, 2008, 08:26:27 PM
hahah lo how did i miss that one?
Title: Re: Additional Stats
Post by: Bluto on August 20, 2008, 10:45:54 PM
I put all the info in a php box and it all works fine, except for the chat integration.
I was trying to get around the regular flash chat integration as it is a boat load of file edits, and I usually always end up with an error.
Am I supposed to already have the Flash Chat Integration installed?
Site: www.ga-squad.com
SMF1.1.5
TP 1.0.5
Theme: Helios_Multi_tp

Edit: Additional Info.
In the script it shows,
<img src="/chat.png"><a href="'.$scripturl.'?action=chat"> <b>Users in Chat</b></a><br />

My url actually shows,
http://www.ga-squad.com/chat/flashchat.php
instead of the expected "action =page"
I don't have friendly url's enabled in settings either, if that makes a difference.
Title: Re: Additional Stats
Post by: robbie93 on August 21, 2008, 12:01:59 AM
very cool :up:

thanks man ;D
Title: Re: Additional Stats
Post by: Lord Anubis on August 21, 2008, 02:18:46 AM
Quote from: Bluto on August 20, 2008, 10:45:54 PM
I put all the info in a php box and it all works fine, except for the chat integration.
I was trying to get around the regular flash chat integration as it is a boat load of file edits, and I usually always end up with an error.
Am I supposed to already have the Flash Chat Integration installed?
Site: www.ga-squad.com
SMF1.1.5
TP 1.0.5
Theme: Helios_Multi_tp

Edit: Additional Info.
In the script it shows,
<img src="/chat.png"><a href="'.$scripturl.'?action=chat"> <b>Users in Chat</b></a><br />

My url actually shows,
http://www.ga-squad.com/chat/flashchat.php
instead of the expected "action =page"
I don't have friendly url's enabled in settings either, if that makes a difference.

yes you need flash chat integration installed
Title: Re: Additional Stats
Post by: Bluto on August 21, 2008, 03:38:37 AM
Bummer. I can't install it through the package manager.
Title: Re: Additional Stats
Post by: G6Cad on August 21, 2008, 06:45:43 AM
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.
Title: Re: Additional Stats
Post by: Bluto on August 21, 2008, 01:00:29 PM
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.
Title: Re: Additional Stats
Post by: Lord Anubis on October 31, 2008, 03:23:02 AM
UPDATED FIRST POST

Title: Re: [Block] Additional Stats
Post by: IchBin on October 31, 2008, 04:46:33 PM
It would be better if you updated the first post. :)
Title: Re: [Block] Additional Stats
Post by: Lord Anubis on October 31, 2008, 07:47:58 PM
will do Ich ;)
Title: Re: [Block] Additional Stats
Post by: Final60 on November 14, 2008, 10:20:41 PM
Thanks alot works a treat!
Title: Re: [Block] Additional Stats
Post by: Final60 on November 21, 2008, 01:35:44 AM
Quote from: Lord Anubis on March 31, 2008, 07:35:55 PM
Flash Chat users can use this one

Screenshot:


(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Ftinyadminresources.com%2Fextras%2Fimagehost%2Fscript%2Fuploads%2F93f4d43abd.jpg&hash=59e8d1598d3b93f928e33587b7d9641b58e8c523)


Heya

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

Thanks in advance :)
Title: Re: [Block] Additional Stats
Post by: Lord Anubis on November 22, 2008, 12:55:03 AM
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 (http://www.ericsworld.eu/f2/index.php)

Screenshot:
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fnextsite.org%2Fforum%2Fimagehost%2Fuploads%2Fe983337e6e.png&hash=40f9c5f57bd639cdca8877e50056936d833e5b3a)

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 (http://www.ericsworld.eu/f2/index.php) installed can use this code
(REMEMBER TO STILL UPLOAD THE arcade.png TO THE ROOT OF YOUR FORUM!!!)

Screenshot:

(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fnextsite.org%2Fforum%2Fimagehost%2Fuploads%2F4d88668e36.png&hash=52543082a662d0c4c3283fc0a00ff046cf10cecf)

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 (http://www.tinyportal.co.uk) - Overall  stats template from old versions of TP
JPDeni (http://www.morethanspike.com/) - New members section
Daniel15 (http://www.daniel15.com/forum/index.php) - FlashChat users
WDM2005 (http://sleepy-arcade.ath.cx/dev/) - Arcade users

Its on the first post
Title: Re: [Block] Additional Stats
Post by: wyckeddreamz on November 30, 2008, 06:01:51 PM
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!!!
Title: Re: [Block] Additional Stats
Post by: fl4pj4ck on November 30, 2008, 06:40:51 PM
any chance to update this code to show mini-avatars of logged-in users?
Title: Re: [Block] Additional Stats
Post by: lurkalot on December 01, 2008, 09:21:59 AM
Will this work with SMF arcade?  If not is there a version that does please.  Looks good. ;)
Title: Re: [Block] Additional Stats
Post by: cme1st2302 on February 27, 2009, 02:18:26 PM
I am trying to get the one with the Flashchat to work but I keep getting the following error

QuoteTable 'eas0825602315011.members' doesn't exist
File: /home/content/b/u/c/buc240/html/eastcoastastro/forums/Sources/SPortal1-1.php(1646) : eval()'d code
Line: 32

Any ideas how to fix this?

Thanks in advance,
Chris
Title: Re: [Block] Additional Stats
Post by: Lord Anubis on February 27, 2009, 04:05:10 PM
you would have to have the flashchat integration mod installed
Title: Re: [Block] Additional Stats
Post by: cme1st2302 on February 27, 2009, 04:43:40 PM
I have it installed and have been using it for some time now.
Title: Re: [Block] Additional Stats
Post by: JPDeni on February 27, 2009, 05:37:25 PM
A lot would depend on what is going on in the S-Portal1-1.php file. From your error message, off the top of my head, I would guess that you're missing the $db_prefix variable in a "global" statement . I could be wrong, though.
Title: Re: [Block] Additional Stats
Post by: cme1st2302 on February 27, 2009, 05:45:55 PM
I have attached my SPortal1-1.php file for you to take a look at.  I do see the $db_prefix variable in the sportal function but I'm not sure if that is what you are talking about.  Please take a look over and see if you can find whats wrong.

Thanks for your assistance,
Chris
Title: Re: [Block] Additional Stats
Post by: JPDeni on February 27, 2009, 06:14:32 PM
That looks right. Try adding $db_prefix to the "global" line of your block.

The code at the beginning of this topic starts with

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


which may have changed by the time you got to it :) but however it looks now, try adding the $db_prefix variable to it:


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


It can't hurt and it might fix your problem.
Title: Re: [Block] Additional Stats
Post by: cme1st2302 on February 27, 2009, 07:46:34 PM
Thanks worked now
Title: Re: [Block] Additional Stats
Post by: JPDeni on February 27, 2009, 08:21:32 PM
Cool! :)
Title: Re: [Block] Additional Stats
Post by: lurkalot on March 03, 2009, 09:01:19 AM
ooh, I've been using this mod since April, but I noticed it throws any blocks below it slightly wider on the left hand side.

Also, noticed that if I move it up under my user block it breaks the frames out of the right hand side of all my R/H blocks.

Didn't notice any of this until I tried to move the stats block, last night.  Any ideas? 

I'm also using the scrolling arcade block, just in case this makes a difference.

Here's a couple of screen grabs to show you what I mean,

Blocks below the additional stats, slightly wider on the left, as marked.

(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fi25.photobucket.com%2Falbums%2Fc89%2Flurkalot%2Fccrsbsg1.jpg&hash=55c8e656bf800485b5c669d5d2b809f629e4a6d5)

The image below, showing the frames broken down the right hand side.  Seems to do this if I move the stats up under the user block.  If I move it down again the frames return to normal.

(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fi25.photobucket.com%2Falbums%2Fc89%2Flurkalot%2Fccrsbsg2.jpg&hash=12faeab431997d75df97b91848836a1d8b8b5f1f)

Checked both problems in firefox and first problem is is still there, but the second problem with the fames is ok, but viewed in IE7 both problems show.  Viewing in firefox with IE Tab addon also shows both the problems.

What I've done so far is to

1: turn the blocks off one by one in various combinations, and the problem is still there.

2: I then turned off the additional stats block, and the alignment returned to normal.  See below.

(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fi25.photobucket.com%2Falbums%2Fc89%2Flurkalot%2Fstatsoffsg3.jpg&hash=6ff3a95fe6c725c8d1b70d4e97e7d5530451cb53)

3:  I turned on the original stats block (the one that comes with tinyportal), and the alignment is still OK.  See below.

(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fi25.photobucket.com%2Falbums%2Fc89%2Flurkalot%2Foldstatsonsg4.jpg&hash=737923e42fe8b7db72ff9d8d50eff5cda7f07f05)

Any help would be appreciated.
Title: Re: [Block] Additional Stats
Post by: lurkalot on March 11, 2009, 05:51:26 PM
Looks like I've killed this thread. :(

Has anyone got any ideas as to why its throwing my blocks out if line?
Title: Re: [Block] Additional Stats
Post by: IchBin on March 11, 2009, 06:30:43 PM
Take the end of the block code:
echo '</div>';
         }
echo '</div>

</div>';


Replace with this:
         }
echo '</div>

</div>';


See if that helps.
Title: Re: [Block] Additional Stats
Post by: lurkalot on March 11, 2009, 07:05:16 PM
Thanks Ichbin, Ill give it a go. ;)
Title: Re: [Block] Additional Stats
Post by: lurkalot on March 11, 2009, 07:12:54 PM
I don't seem to have that code at the end.  ??? 

I'm using the third one down on the first page.  This is the one I'm using,


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.$txt['tp-total'].': '.$online['total_users'].'<hr />
<div style="width: 98%; ' , $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: 98%; ' , $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>';
Title: Re: [Block] Additional Stats
Post by: IchBin on March 11, 2009, 08:07:58 PM
Thats because you're using the second code in the first post. Would help if you specify that stuff. Regardless, the code is still there, you just need to look a little higher. :)
Title: Re: [Block] Additional Stats
Post by: lurkalot on March 11, 2009, 09:48:23 PM
Sorry Ichbin

I'm using the third code in the first post.  The one for e-arcade, and no flashchat

Can't find the code you mentioned, only this bit.  I'm no coder, and find this stuff very confusing.   ;)


    echo '<br />';
     }
    echo '</div>';

       }
  echo '</div>';
Title: Re: [Block] Additional Stats
Post by: IchBin on March 12, 2009, 03:15:08 PM
Try removing the very last </div> and see if that helps. If not, I don't know what to tell you. This code looks a little messed up anyway.
Title: Re: [Block] Additional Stats
Post by: Stroopy on March 18, 2009, 02:42:52 PM
When I use the code Lord Anubis posted I get this error twice everytime someone visits the main page in the error log.

http://xxxxx.com/index.php
Apply Filter: Only show the errors with the same message
8: Undefined index: name
File: /home/xxxxx/public_html/Themes/default/TPortal.template.php (main_below sub template - eval?)
Line: 81

The error happens when I have the code posted in a PHP block and have it activated.
Title: Re: [Block] Additional Stats
Post by: JPDeni on March 18, 2009, 04:27:56 PM
The first code in this topic does not use an index called 'name'. In fact, the word 'name' is not in the code at all. If you're not using the first code in the topic, post the code you are using so I can try to debug it.
Title: Re: [Block] Additional Stats
Post by: lurkalot on March 18, 2009, 06:42:17 PM
Quote from: IchBinâ„¢ on March 12, 2009, 03:15:08 PM
Try removing the very last </div> and see if that helps. If not, I don't know what to tell you. This code looks a little messed up anyway.

Thanks, that seems to have sorted the alignment problem. ;)  However I do have another problem.   I have removed the flash chat part of the code, as I don't have flash chat installed.  Not sure if I did that correctly, but the block looks OK when activated.  It's now showing a error in the error log.  Can anyone help me with this please?

http://xxxxxxxxxxxxx.com/forum/index.php 
8: Undefined index: action
File: /home/xxxxxxxxxx/public_html/forum/Themes/default/TPortal.template.php (main_above sub template - eval?)
Line: 96

Here's the edited code if anyone could help me sort it,


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'];
   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>';


Title: Re: [Block] Additional Stats
Post by: JPDeni on March 18, 2009, 07:22:14 PM
As with the previous poster, the undefined index is not in the code that you posted. This means that the problem is not with this code.

Just to give a little bit of info, individual parts of an array uses a variable name and an index. In your code, $settings['images_url'] is a part of an array. The variable name is $settings and the index is ['images_url']. Php gets annoyed when there is mention of an index that has not been defined before it's mentioned.

This is one of the easier things to find while debugging, assuming that you have the right code. All you have to do is search for the undefined index. Then you need to work out how to define it.

There is no place in your code where the index ['action'] appears. Therefore, the problem must be in another bit of code, such as a file or another block.
Title: Re: [Block] Additional Stats
Post by: IchBin on March 18, 2009, 07:56:11 PM
Deni, there is this in the code.
   if($data['action']=='arcade')

I don't understand what serializing does though really....
Title: Re: [Block] Additional Stats
Post by: JPDeni on March 18, 2009, 08:02:46 PM
I just copied the code that lurkalot posted, put it into my text editor and did a search for "action." I didn't find it. Hmmmm. The search on my text editor isn't working.

But I found it.

Change that line to


   if ((isset($data['action']) && ($data['action']=='arcade'))


That will get rid of the error message.
Title: Re: [Block] Additional Stats
Post by: lurkalot on March 18, 2009, 08:31:23 PM
Thanks, but that messed my front page up, and showed this where the block should be,

Quote
Parse error: syntax error, unexpected '{' in /home/xxxxxxxx/public_html/forum/Sources/Load.php(1756) : eval()'d code(35) : eval()'d code on line 97

Taking out one of the two = out of the line Itchbin posted does seem to have fixed it though. ;)   Is it ok to leave it like this?
Title: Re: [Block] Additional Stats
Post by: IchBin on March 18, 2009, 08:44:41 PM
You probably should post your code with the changes you've made.
Title: Re: [Block] Additional Stats
Post by: JPDeni on March 18, 2009, 09:29:43 PM
QuoteTaking out one of the two = out of the line Itchbin posted does seem to have fixed it though. Wink   Is it ok to leave it like this?
You won't get the error, but the code won't work right, so it would probably be better just to take out that section of code, if you don't care whether it works or not.

If you do care whether it works or not, like IchBin said, post your code that gives a problem and we'll debug it.
Title: Re: [Block] Additional Stats
Post by: lurkalot on March 18, 2009, 09:59:05 PM
Quote from: JPDeni on March 18, 2009, 09:29:43 PM
QuoteTaking out one of the two = out of the line Itchbin posted does seem to have fixed it though. Wink   Is it ok to leave it like this?
You won't get the error, but the code won't work right, so it would probably be better just to take out that section of code, if you don't care whether it works or not.

If you do care whether it works or not, like IchBin said, post your code that gives a problem and we'll debug it.

Thanks, it was the code below after I replace the line you gave me. ;)


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'];
   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 ((isset($data['action']) && ($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>';
Title: Re: [Block] Additional Stats
Post by: JPDeni on March 18, 2009, 10:22:30 PM
I guess I had too many parentheses. This gives no error.


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'];
   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 (isset($data['action']) && ($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>';
Title: Re: [Block] Additional Stats
Post by: lurkalot on March 18, 2009, 10:52:44 PM
Thanks and well done.  It works great now, and with no errors so far. :)
Title: Re: [Block] Additional Stats
Post by: JPDeni on March 19, 2009, 12:59:06 AM
Cool. :)
Title: Re: [Block] Additional Stats
Post by: lurkalot on April 19, 2009, 04:38:07 PM
Probably asking in the wrong place, but,

Anyone managed to pull any info from a Coppermine gallery, and add it to this block?


etc, etc.

I can't seem to find any way of doing something like this, and I've searched everywhere.  Even asked over at http://coppermine-gallery.net , and http://www.simplemachines.org/ to no avail.  There must be loads of people using smf, and coppermine, and having the same problem.

I have SMF 1.1.8 bridged with Coppermine 1.4.21, and tinyportal 0.9.8
Title: Re: [Block] Additional Stats
Post by: Ken. on April 19, 2009, 05:19:01 PM
Did you take a look at CpmFetch on the CPG forum?

I've not looked at it in some time now, but I think it had some stats capability to go along with it's image displays.
Title: Re: [Block] Additional Stats
Post by: lurkalot on April 19, 2009, 05:34:21 PM
Thanks Ken.   

I'm using copperminefetch to pull images to my latest images front page block.

My problem is the users online doesn't show when someone is in the gallery, it just shows them as "Viewing the board index of cameracraniums.com"

Would be nice if I could get this to show them in the additional stats block I'm using.  like, Users in gallery and  Member name  underneath, much like the part that shows users in arcade.
Title: Re: [Block] Additional Stats
Post by: ZarPrime on April 19, 2009, 05:45:03 PM
lurkalot,

Hang around for awhile and be patient.  Perhaps Lord Anubis will see this and be able to add something to the code for you to be able to do this since he wrote the original code.

ZarPrime
Title: Re: [Block] Additional Stats
Post by: lurkalot on April 22, 2009, 07:52:07 AM
Quote from: ZarPrime on April 19, 2009, 05:45:03 PM
lurkalot,

Hang around for awhile and be patient.  Perhaps Lord Anubis will see this and be able to add something to the code for you to be able to do this since he wrote the original code.

ZarPrime

Thanks.  I did ask a similar question directly on Lord Anubis's site a year ago, think he was stumped then. lol...

I also just asked again over at http://coppermine-gallery.net/, and was told that Coppermine doesn't record that info, so there's no easy way to accomplish that tracking.  see here, http://forum.coppermine-gallery.net/index.php/topic,59120.0.html

That said, I'm sure I've seen this done on sites before, just can't find one now, to ask them. :(

Looks like I'll have to give up on this one.
Title: Re: [Block] Additional Stats
Post by: Ianedres on April 23, 2009, 04:36:51 AM
I am 99% sure that Coppermine does not track your current position through the database, which would be how SMF would obtain that info... ::)
Title: Re: [Block] Additional Stats
Post by: Lord Anubis on April 23, 2009, 03:40:18 PM
Quote from: lurkalot on April 22, 2009, 07:52:07 AM

Thanks.  I did ask a similar question directly on Lord Anubis's site a year ago, think he was stumped then. lol...


Correct, I never used Coppermine so have no idea how incorporate this  ???
Title: Re: [Block] Additional Stats
Post by: lurkalot on April 23, 2009, 05:46:42 PM
Quote from: Lord Anubis on April 23, 2009, 03:40:18 PM
Quote from: lurkalot on April 22, 2009, 07:52:07 AM

Thanks.  I did ask a similar question directly on Lord Anubis's site a year ago, think he was stumped then. lol...


Correct, I never used Coppermine so have no idea how incorporate this  ???

Thanks Lord Anubis

Just to be clear, I wasn't having a dig at you, I know you tried very hard to help me. ;) 

I was wondering if there was some sort of script I could put in my gallery sub directory that could show users visiting the gallery, and then pull the info to the bottom of this block.  Anyone know if there is such a thing, and if this is possible? 
Title: Re: [Block] Additional Stats
Post by: Lord Anubis on April 23, 2009, 08:49:12 PM
there is a few, search google for "users online script", I doubt it will grab their usernames without modification, but it will allow you to show how many people are on that page for a certain time interval