Users Online Today Mod

Started by Nibogo, November 06, 2005, 01:42:31 AM

Previous topic - Next topic

scottws

#340
Quote from: akulion on May 15, 2006, 04:19:30 PM

Users with this problem follow these instructions:

1. Go to your theme folder for the theme in which u are having this problem

2. Go to the Languages folder and download this file Modifications.english.php

3. Make a backup of this file in case u mess up

4. Open the file in a text editor and just before the ?> right at the end of the file, add the following code



$txt['uot_users_online_today_title']='Users Seen Today';
$txt['uot_user_online_today']='user seen today';
$txt['uot_users_online_today']='users seen today';
$txt['uot_total_users_online_today']='Users Seen Today';
$txt['uot_yesterday']='Yesterday at ';



4. save and upload

I am not seeing a Modifications.english.php file in Themes/helios_multi11rc2/languages/.

SpyDie

Quote from: akulion on May 15, 2006, 04:19:30 PM
I am not seeing a Modifications.english.php file in Themes/helios_multi11rc2/languages/.

In which case, go and open a New Notepad window on your own system.

Copy & paste the contents of this box into it. Save it as Modifications.english.php, upload it to Themes/helios_multi11rc2/languages/.

Quote<?php

$txt['uot_users_online_today_title']='Users Seen Today';
$txt['uot_user_online_today']='user seen today';
$txt['uot_users_online_today']='users seen today';
$txt['uot_total_users_online_today']='Users Seen Today';
$txt['uot_yesterday']='Yesterday at ';

?>

Works perfectly on my own forum, I have mutliple themes - I placed this into every single theme folder and it worked perfectly.

HTH
Beta. Software undergoes beta testing shortly before it's released. Beta is Latin for 'still doesn't work.'

scottws

#342
I was going to try that, but I wasn't sure it would make a difference.

I've been told not to edit PHP files with Notepad.  I use vim directly on the server.

scottws

#343
Ok, SpyDie's modifications seemed to work, but I was wondering if there was a way to make it more like how it appears on the default theme:

QuoteTotal: 2 (Visible: 2, Hidden: 0)

instead of how it is now after doing the modification:

Quote2 users seen today

Edit: It looks like it has something to do with this in beemer's code for BoardIndex.template.php:

echo $context['num_users_online_today'], ' ', $context['num_users_online_today']
      == 1 ? $txt['uot_user_online_today'] : $txt['uot_users_online_today'];


It looks like that is showing a number (the number of users that were online), then testing if that number is equal to one or not, and then using one of two variables depending on the result.

So I could probably move that around and then change the value of the variables in Modifications.english.php to reflect what appears in the default theme for this mod.  The problem comes in that I don't know PHP very well at all, so I don't want to break the line of code by trying to move stuff around.

Vinspire

Follow akulion guide but i still couldn't get it working. Anyone manage to get it working ?

Carceri

Quote from: scottws on May 16, 2006, 02:25:13 PM
QuoteTotal: 2 (Visible: 2, Hidden: 0)

instead of how it is now after doing the modification:

Quote2 users seen today
This was changed from the second to the first in a later version of the mod. Probably the code you are trying to use is based on an old version of this mod.

Vinspire

Quote from: Carceri on May 17, 2006, 05:49:27 AM
Quote from: scottws on May 16, 2006, 02:25:13 PM
QuoteTotal: 2 (Visible: 2, Hidden: 0)

instead of how it is now after doing the modification:

Quote2 users seen today
This was changed from the second to the first in a later version of the mod. Probably the code you are trying to use is based on an old version of this mod.

Carceri, yep. That is what i suspect too that beemer code is from the old version but when i tried it with the new codes ... it gaves me an error.

Gobo

#347
Quote from: Vinspire on May 17, 2006, 05:27:39 AM
Follow akulion guide but i still couldn't get it working. Anyone manage to get it working ?

Please note the following Error I made in posting the last code (I have fixed it in my last post as well but posting here just so that everyone knows)

The boardindex.template.php file must be modified as following: (for helios theme)

Download you boardindex.template.php file is to simply look for this line:

// If they are logged in, but SP1 style information is off... show a personal message bar.

it occurs in all the themes --- just place the following code above it





// Users online today
echo '
<tr>
<td class="titlebg" colspan="2">', $txt['uot_users_online_today_title'], '</td>
</tr><tr>
<td class="windowbg" width="20" valign="middle" align="center">
<img src="', $settings['images_url'], '/icons/online.gif" alt="', $txt[158], ' ', $txt['uot_users_online_today_title'], '" border="0" />
</td>
<td class="windowbg2" width="100%">';

echo '
<div class="smalltext">';

echo $context['num_users_online_today'], ' ', $context['num_users_online_today'] == 1 ? $txt['uot_user_online_today'] : $txt['uot_users_online_today'];

// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($context['users_online_today']))
echo ':<br />', implode(', ', $context['list_users_online_today']);

echo '
<br />', $context['show_stats'] && !$settings['show_sp1_info'] ? '
<a href="' . $scripturl . '?action=stats">' . $txt['smf223'] . '</a>' : '', '
</div>
</td>
</tr>';





That should fix it :)

Important Always remember to make a back-up of your original file before any modifications are made - that way EVEN if something goes wrong you dont have to worry because you can upload the old file and everything will be back to normal :)



================================================================
==============Below are steps ONLY for people who have already modified the file using my past instructions====================================================

Simply find this in your boardindex.template.php file and REMOVE it



', $txt['most_online_ever'], ': ', $modSettings['mostOnline'], ' (' , timeformat($modSettings['mostDate']), ')
</span>
</td>
</tr>';
]]></search>
<add><![CDATA[




this was the part I had accidentally included in the code from the mod package - what it simply does is search and replace a bit of code - so removing it should fix any sort of errors :) A good way to search for the above code would be to simply do a search for <add><![CDATA[

find it - compare the 2 bits of code in your file and the one given here and remove it :)

scottws

Quote from: Carceri on May 17, 2006, 05:49:27 AM
Quote from: scottws on May 16, 2006, 02:25:13 PM
QuoteTotal: 2 (Visible: 2, Hidden: 0)

instead of how it is now after doing the modification:

Quote2 users seen today
This was changed from the second to the first in a later version of the mod. Probably the code you are trying to use is based on an old version of this mod.

Ok, well then does anyone have any idea how to get this properly working on the Helios theme?

Vinspire

Quote from: scottws on May 17, 2006, 08:37:09 AM
Quote from: Carceri on May 17, 2006, 05:49:27 AM
Quote from: scottws on May 16, 2006, 02:25:13 PM
QuoteTotal: 2 (Visible: 2, Hidden: 0)

instead of how it is now after doing the modification:

Quote2 users seen today
This was changed from the second to the first in a later version of the mod. Probably the code you are trying to use is based on an old version of this mod.

Ok, well then does anyone have any idea how to get this properly working on the Helios theme?

Scott, I am looking for the same answer as well. Did you tried akulion codes ? I did tried but it gaves me an error. Guess i did something wrong with the codes. :( :( :(

rsj1

#350
Is there a way to make this hack (I'm using 1.4 beta) with the default skin show users online in the last 24 hours (IE keep cycling around instead of resetting at midnight)? Any help or suggestions would be most appreciated ;)

Carceri

#351
Quote from: rsj1 on May 17, 2006, 04:51:00 PM
Is there a way to make this hack (I'm using 1.4 beta) with the default skin show users online in the last 24 hours (IE keep cycling around instead of resetting at midnight)? Any help or suggestions would be most appreciated ;)

That should be easy. In BoardIndex.php find


$nowdate = @getdate(forum_time(false));
$midnight = mktime(0, 0, 0, $nowdate['mon'], $nowdate['mday'], $nowdate['year']) - ($modSettings['time_offset'] * 3600);


And replace with


$midnight = time() - 86400;


And in Stats.php find


$frag = explode('-', strftime('%Y-%m-%d', time()));
$midnight = forum_time(false, mktime(0, 0, 0, (int) $frag[1], (int) $frag[2], (int) $frag[0]));


and replace with


$midnight = time() - 86400;


Also edit Modifications.english.php to the appropriate text you want displayed

rsj1

 ;D Many thanks it worked a treat!

Quote from: Carceri on May 18, 2006, 07:20:56 AM
Quote from: rsj1 on May 17, 2006, 04:51:00 PM
Is there a way to make this hack (I'm using 1.4 beta) with the default skin show users online in the last 24 hours (IE keep cycling around instead of resetting at midnight)? Any help or suggestions would be most appreciated ;)

That should be easy. In BoardIndex.php find


$nowdate = @getdate(forum_time(false));
$midnight = mktime(0, 0, 0, $nowdate['mon'], $nowdate['mday'], $nowdate['year']) - ($modSettings['time_offset'] * 3600);


And replace with


$midnight = time() - 86400;


And in Stats.php find


$frag = explode('-', strftime('%Y-%m-%d', time()));
$midnight = forum_time(false, mktime(0, 0, 0, (int) $frag[1], (int) $frag[2], (int) $frag[0]));


and replace with


$midnight = time() - 86400;


Also edit Modifications.english.php to the appropriate text you want displayed

kriskd

#353
Quote from: akulion on May 15, 2006, 04:19:30 PM
Quote


Users with this problem follow these instructions:

1. Go to your theme folder for the theme in which u are having this problem

2. Go to the Languages folder and download this file Modifications.english.php

3. Make a backup of this file in case u mess up

4. Open the file in a text editor and just before the ?> right at the end of the file, add the following code



$txt['uot_users_online_today_title']='Users Seen Today';
$txt['uot_user_online_today']='user seen today';
$txt['uot_users_online_today']='users seen today';
$txt['uot_total_users_online_today']='Users Seen Today';
$txt['uot_yesterday']='Yesterday at ';



4. save and upload
Quote from: akulion on May 17, 2006, 07:44:12 AM
Please note the following Error I made in posting the last code (I have fixed it in my last post as well but posting here just so that everyone knows)

The boardindex.template.php file must be modified as following: (for helios theme)

Download you boardindex.template.php file is to simply look for this line:

// If they are logged in, but SP1 style information is off... show a personal message bar.

it occurs in all the themes --- just place the following code above it





// Users online today
echo '
<tr>
<td class="titlebg" colspan="2">', $txt['uot_users_online_today_title'], '</td>
</tr><tr>
<td class="windowbg" width="20" valign="middle" align="center">
<img src="', $settings['images_url'], '/icons/online.gif" alt="', $txt[158], ' ', $txt['uot_users_online_today_title'], '" border="0" />
</td>
<td class="windowbg2" width="100%">';

echo '
<div class="smalltext">';

echo $context['num_users_online_today'], ' ', $context['num_users_online_today'] == 1 ? $txt['uot_user_online_today'] : $txt['uot_users_online_today'];

// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($context['users_online_today']))
echo ':<br />', implode(', ', $context['list_users_online_today']);

echo '
<br />', $context['show_stats'] && !$settings['show_sp1_info'] ? '
<a href="' . $scripturl . '?action=stats">' . $txt['smf223'] . '</a>' : '', '
</div>
</td>
</tr>';





That should fix it :)

Important Always remember to make a back-up of your original file before any modifications are made - that way EVEN if something goes wrong you dont have to worry because you can upload the old file and everything will be back to normal :)

I have done both these steps.  First on my test forum and I got it working beautifully.  Then, I went to duplicate it on my real forum and for whatever reason I can't get it to work.  Here is what is displayed:

Attachment deleted

Does this give anyone a clue as to what I did wrong?
SMF 2.0.2

kriskd

Okay, never mind on my users online today.  I got it working, but now my SMF shoutbox isn't working.  I'll try that thread now....
SMF 2.0.2

cyberstang5.0

Quote from: cyberstang5.0 on May 10, 2006, 09:45:24 PM
Quote from: DemonicInfluence on March 08, 2006, 11:37:39 AM
just make it so that
if($context['user']['is_admin'])
{


is before the mod stuff in the boardindex.template.php of every theme.

Then at the end put
}

Should work to only allow admins to see..

Another stupid programing question for ya'll...

How do I get it so admins and moderators (or specific membergroups) see the list but keep it "hidden" from regular users?  ???
Anyone?  ??? ??? :(

DemonicInfluence

That is how to keep hidden from other users other than admin...

For moderators try only allowing the moderator group?

cotdagoo

using the latest version of the mod, and 1.1rc2 of SMF - I'm having banned users showing up on the users online today list.. is it possible to have this removed? I keep getting questions from my members about banned poeple accessing the forum.

any help is appreciated.

Bigguy

You might see them online but I think all there viewing is a "You are banned" message.

cotdagoo

Quote from: Bigguy on June 03, 2006, 11:53:43 AM
You might see them online but I think all there viewing is a "You are banned" message.

Indeed.. however it's still somewhat confusing to regular members who don't have access to viewing error logs to see that it's just a ban message. I've litterally gotten about 10-15 PMs from people asking why banned names still show up (just in the past 2 days)

Is there not any way to filter banned users out of the list, much like the hidden users are? Seems kinda silly to include users that are banned in the list.. perhaps that's just my personal prefrence though.

cheers

Advertisement: