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,982
  • Total Topics: 21,320
  • Online today: 647
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 336
  • Total: 336

Online Today Snipe.

Started by -BeNt-, November 18, 2006, 10:53:41 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Techdomain

My take on it:
Removed "new this week" and "new today",
Swapped order of latest member and new this month,
Added Spiders line for Googlebot mod.


global $db_prefix, $txt, $scripturl, $modSettings;

$today = strtotime("today");
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 '<span class="smalltext">';
echo '<img src="/Themes/Aero79_smf11RC2_TP2/images/icons/members.gif"><b><a href="/index.php?action=mlist"> Members </a></b><br />';
echo '<img src="/Themes/Aero79_smf11RC2_TP2/images/TPdivider.gif"> Total Members: ', $modSettings['totalMembers'],'<br />';
/*
echo '<img src="/Themes/Aero79_smf11RC2_TP2/images/TPdivider.gif"> New This Year: ', $row['year'],'<br />';
*/
echo '<img src="/Themes/Aero79_smf11RC2_TP2/images/TPdivider.gif"> New This Month: ', $row['month'],'<br />';
echo '<img src="/Themes/Aero79_smf11RC2_TP2/images/TPdivider.gif"> Latest: <a href="', $scripturl, '?action=profile;u=', $modSettings['latestMember'], '"><b>', $modSettings['latestRealName'], '</b></a><br>';

echo ' <table>
                  <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 /><img src="/Themes/Aero79_smf11RC2_TP2/images/TPdivider.gif"> Total Posts: '.$modSettings['totalMessages']. '
                                  <br /><img src="/Themes/Aero79_smf11RC2_TP2/images/TPdivider.gif"> Total Topics: '.$modSettings['totalTopics']. '
                                  <br /><img src="/Themes/Aero79_smf11RC2_TP2/images/TPdivider.gif"> Most Ever Online: '.$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.'Spiders: '.$online['num_spiders'];
   echo '<br />'.$bullet.$txt['tp-total'].': '.$online['total_users'].'<hr />
<div style="width: 100%; ' , $online['num_users']>10 ? 'height: 23ex;overflow: auto;' : '' ,'">';

     
// add online today
            echo '<br /><b>Last 10 Online Today</b><br />';

            $online = ssi_whosOnline_today('array');

echo $bullet.$txt['tp-total'].': '.$online['num_users_online_today'].'
<div style="width: 100%; ' , $online['num_users_online_today']>10 ? 'height: 30ex;overflow: auto;' : '' ,'"><br />';

$i = 0;
foreach($online['users_online_today'] as $user)
{
  ++$i;
  if ($i > 10)
    break;
if ($user['is_online'])
echo '<img src="/Themes/Aero79_smf11RC2_TP2/images/useron.gif">' , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
else
echo '<img src="/Themes/Aero79_smf11RC2_TP2/images/useroff.gif">' , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];

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

echo '<br /></td></tr></table>';
echo '</span>';


Thankyou very much for the code!
Note: I had to follow the proceedure here to get it to work (already had the users online today mod installed)

-BeNt-

Guess I should have added that in,you WILL need the online today mod for this to work.Awesome with the spiders thing,may have to give it a whirl.

And yes I was using a custom theme the Tp_Counter-Strike theme by someone on this website.Modded heavily like everyone elses site :) You can use the TP varibles to pull the image ect instead of hardcoding the paths like I did but I couldn't get it to work for some reason?

Techdomain

worked fine with the hardcode - So long as you find replace the theme listed for the one you are using (check to see that the icon file exists first!)

This website is proudly hosted on Crocweb Cloud Website Hosting.