Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

August 12, 2022, 05:37:17 PM

Login with username, password and session length
Members
  • Total Members: 3842
  • Latest: Kokoro
Stats
  • Total Posts: 193479
  • Total Topics: 21088
  • Online today: 50
  • Online ever: 1035
  • (November 26, 2020, 04:45:12 AM)
Users Online
Users: 0
Guests: 39
Total: 39

Author Topic: Online Today Snipe.  (Read 9448 times)

0 Members and 1 Guest are viewing this topic.

Techdomain

  • Guest
Re: Online Today Snipe.
« Reply #10 on: November 25, 2006, 05:49:03 PM »
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.

Code: [Select]
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-

  • Guest
Re: Online Today Snipe.
« Reply #11 on: November 27, 2006, 01:34:40 AM »
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

  • Guest
Re: Online Today Snipe.
« Reply #12 on: November 27, 2006, 05:21:01 AM »
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!)