Advertisement:

Author Topic: Add total time spent online to users profile  (Read 22424 times)

Offline Ivan Minic

  • Full Member
  • ***
  • Posts: 513
  • Gender: Male
  • Owner: www.Burek.com
    • Burek Forum
Add total time spent online to users profile
« on: February 12, 2006, 09:58:23 PM »
Open: Profile.template.php
Find:
Code: [Select]
// If the person looking is an admin they can check the members IP address and hostname.
if ($user_info['is_admin'])
{
echo '
<tr>
<td width="40%">
<b>', $txt[512], ': </b>
</td><td>
<a href="', $scripturl, '?action=trackip;searchip=', $context['member']['ip'], '" target="_blank">', $context['member']['ip'], '</a>
</td>
</tr><tr>
<td width="40%">
<b>', $txt['hostname'], ': </b>
</td><td width="55%">
<div title="', $context['member']['hostname'], '" style="width: 100%; overflow: hidden; font-style: italic;">', $context['member']['hostname'], '</div>
</td>
</tr>

Replace with:
Code: [Select]
// If the person looking is an admin they can check the members IP address and hostname.
if ($user_info['is_admin'])
{
echo '
<tr>
<td width="40%" align="right">
<b>', $txt[512], ': </b>
</td><td>
<a href="', $scripturl, '?action=trackip;searchip=', $context['member']['ip'], '" target="_blank">', $context['member']['ip'], '</a>
</td>
</tr>';
}
echo '
<tr>
<td colspan="2"><hr size="1" width="100%" class="hrcolor" /></td>
</tr>
<tr>
<td align="right"><b>', $txt['statPanel_total_time_online'], ':</b></td>
<td>', $context['member']['time_logged_in'], '</td>
</tr>';
Add to Profile.english.php in language files:
Code: [Select]
$txt['statPanel_total_time_online'] = 'Total Time Spent Online';
« Last Edit: February 13, 2006, 10:47:43 PM by .diplomat »

Offline husmen73 (Gulhin)

  • SMF Hero
  • ******
  • Posts: 3,687
  • Gender: Male
  • Bana ulaşmak için lütfen e-posta gönderin.
    • Gülhin İnternet
Re: Add total time spent online to users profile
« Reply #1 on: October 05, 2006, 10:52:58 AM »
', $context['member']['time_logged_in'], '

this code dont work :S

There isn't describe
-Kurumsal Kimlik Web Tasarım Hizmeti.
Gülhin Portal Sistemi hakkında yorumlarınızı bekliyorum.
SMF
Referanslar --> http://www.gulhin.com/referanslar-portfoy/
-Web Tasarımı ve Tema Tasarımı Sitesi www.gulhin.com
-TOPLU MAİL GÖNDERİMİ --> http://www.toplumailsms.com
E-Ticaret Sistemi yaptırmak mı istiyorsunuz?

Offline dannbass

  • Sr. Member
  • ****
  • Posts: 768
  • Ex.php?erto
Re: Add total time spent online to users profile
« Reply #2 on: January 17, 2008, 07:25:45 PM »
One thing that worked for me is this... but only if they are registered users... otherwise is a 0 minutes displayed... instead of the last part of the replace code.

If anybody has a better solution... please feel free to post it!
Code: [Select]
<tr>';
// Show the total time logged in?
if (!empty($context['user']['total_time_logged_in']))
{
echo '
<td><b>', $txt['totalTimeLogged1'], '</b></td>
<td>';

// If days is just zero, don't bother to show it.
if ($context['user']['total_time_logged_in']['days'] > 0)
echo $context['user']['total_time_logged_in']['days'] . $txt['totalTimeLogged2'];

// Same with hours - only show it if it's above zero.
if ($context['user']['total_time_logged_in']['hours'] > 0)
echo $context['user']['total_time_logged_in']['hours'] . $txt['totalTimeLogged3'];

// But, let's always show minutes - Time wasted here: 0 minutes ;).
echo $context['user']['total_time_logged_in']['minutes'], $txt['totalTimeLogged4'], '<br />';
}
echo'
</td>
</tr>
« Last Edit: January 17, 2008, 07:28:09 PM by dannbass »

Offline Bulakbol

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,220
  • Gender: Male
  • JohnyB
Re: Add total time spent online to users profile
« Reply #3 on: January 22, 2008, 01:16:15 AM »
Here's my share.  Day or days, hour or hours, minute or minutes.

Code: [Select]
// Show the total time logged in?
if (!empty($context['user']['total_time_logged_in']))
{
echo '
', $txt['totalTimeLogged1'];

// If days is just zero, don't bother to show it.
if ($context['user']['total_time_logged_in']['days'] > 0)
echo $context['user']['total_time_logged_in']['days'], ' ',
$context['user']['total_time_logged_in']['days'] > 1 ? $txt['totalTimeLogged2'] : 'day, ';

// Same with hours - only show it if it's above zero.
if ($context['user']['total_time_logged_in']['hours'] > 0)
echo $context['user']['total_time_logged_in']['hours'], ' ',
$context['user']['total_time_logged_in']['hours'] == 1 ? 'hour and ' : $txt['totalTimeLogged3'];

// But, let's always show minutes - Time wasted here: 0 minutes ;).
echo $context['user']['total_time_logged_in']['minutes'],
$context['user']['total_time_logged_in']['minutes'] == 1 ? 'minute.' : $txt['totalTimeLogged4'], '<br />';
}
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

Offline Sabre™

  • SMF Hero
  • ******
  • Posts: 2,527
  • Gender: Male
  • IF IT AINT BROKE, I CAN FIX IT TILL IT IS!!
Re: Add total time spent online to users profile
« Reply #4 on: November 05, 2008, 06:05:27 AM »
Hey there Johny,
your code shows whoevers time logged, no matter what profile theyre looking at.
eg..  I see my time logged if Im looking at anyones profile.
Is this supposed to do that, or show you that persons time logged in their profile?

Do NOT give admin and/or ftp details to just anybody, see if they are trust worthy first!!  Do your homework ;)