Users Online Today Mod

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

Previous topic - Next topic

SpyDie

This explains it simple enough:

http://www.simplemachines.org/community/index.php?topic=55513.msg575925#msg575925

Just edit the BoardIndex.template.php file in each of your Themes folders like said there.
Beta. Software undergoes beta testing shortly before it's released. Beta is Latin for 'still doesn't work.'

Joshsux

#421
Thanks, i found it and it works fine now mate.

Edit: is there anyway to make the number of people number on the same line as the people? atm it looks like this:

4 :
NAME, NAME, NAME, NAME

Anyway to make it like

4 : NAME, NAME, NAME, NAME   

Would look better wouldn't it?
If you can't hear it before you see it, then it ain't a harley

Joshsux

#422
Quote from: rsj1 on May 20, 2006, 11:02:56 AM
;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

im using the Aa_New_Damage and i wanna do what he is doing with the 24 hour thing instead of midnight right, but i don't have a stats.php? i also can't find that code.
If you can't hear it before you see it, then it ain't a harley

Carceri

Quote from: Joshsux on August 09, 2006, 01:48:53 AM
but i don't have a stats.php?

Yes you do. It's a part of SMF, not the themes.

Joshsux

oh ok lol, so any idea how to get it working with this theme? i got it working i mean to make it so its 24 hour loop, i dont have any of the file but maybe stats.php will that work?
If you can't hear it before you see it, then it ain't a harley

Carceri

Quote from: Joshsux on August 09, 2006, 11:23:57 PM
oh ok lol, so any idea how to get it working with this theme? i got it working i mean to make it so its 24 hour loop, i dont have any of the file but maybe stats.php will that work?

No, you have to change BoardIndex.php for that as mentioned above. Note that this file is NOT the same as BoardIndex.template.php

Joshsux

mmmm hmmmm and where do i find this "BoardIndex.php" as i can't find it NO WHERE in my FTP....? why do people help but only give little replies thinking people know everything how the hell am i suppose to know where this file is?
If you can't hear it before you see it, then it ain't a harley

Bigguy

umm, I do believe it is in the Sources folder, were you have installed your forum.

Carceri

Quote from: Joshsux on August 11, 2006, 01:55:51 AM
why do people help but only give little replies thinking people know everything how the hell am i suppose to know where this file is?

Well, it appears as if you found Stats.php. BoardIndex.php is in the same directory, so I assumed that would be equally easy to find :)

Joshsux

Yeeh hey i got it to work thanks you guys for helping me  8)
If you can't hear it before you see it, then it ain't a harley

deadpoeticstar

could this be about ready for an RC3 update?

Carceri

Quote from: deadpoeticstar on August 14, 2006, 12:09:08 PM
could this be about ready for an RC3 update?

Sure, as soon as SMF RC3 is released I will make this mod compatible with it.

kittykatt

Sorry if I am missing something... but when will it be ready for SMF 1.0.7.?
I have 1.1.7 version

Carceri

It will never be ready for 1.0. It will be ready for 1.1 when it is released.

I have also added a version for 1.1 RC3 now, but since there are no changes between RC2 and RC3 in the files that this mod affects, that version should also be compatible with RC2.

ckgb

Thank you very much for RC3 virsion of the mod.

I understand by default only registered users can see the names in the users today list.

Where can I change the permissions so that everybody is able to see the full list and not the number alone.

Carceri

Quote from: ckgb on August 24, 2006, 08:26:29 PM
Where can I change the permissions so that everybody is able to see the full list and not the number alone.

Edit BoardIndex.template and remove the line that says

if (!$context['user']['is_guest'])

Also, change the line

if (!empty($context['users_online_today']) && !$context['user']['is_guest'])

to

if (!empty($context['users_online_today']))

That should do it (although I have not tested)


ckgb

It did the trick. Thank you very much.

scottws

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

I am interested in also using this mod to represent the users online in the last 24 hours instead of the last day with a reset at 12:00am.

However, 'm not finding this code to edit mentioned in the files.  I searched ./Sources/BoardIndex.php by "nowdate" and it found nothing.  I also searched ./Sources/Stats.php by "frag" and by "explode" and found nothing. I just installed the newest version of this mod on 1.1 RC3 three days ago.

Here is what I am finding in ./Sources/BoardIndex.php that might be similar:

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


As for ./Sources/Stats.php, I wasn't sure I could find what you were instructing, so I am posting all of what I found that seems to be related to this mod:

// Members online so far today.
$result = db_query("
SELECT mostOn
FROM {$db_prefix}log_activity
WHERE date = $date
LIMIT 1", __FILE__, __LINE__);
list ($context['online_today']) = mysql_fetch_row($result);
mysql_free_result($result);

$context['online_today'] = (int) $context['online_today'];

// Total members online today
$date = @getdate(forum_time(false));
$midnight = mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']) - ($modSettings['time_offset'] * 3600);
$result = db_query("
SELECT
COUNT(*)
FROM {$db_prefix}members
WHERE lastLogin >= $midnight", __FILE__, __LINE__);
list ($context['total_users_online_today']) = mysql_fetch_row($result);


Has the code used in the mod changed since the quoted post was made?  What do I have to change to get my idea to work?

Carceri

Quote from: scottws on August 26, 2006, 12:08:56 AM
Has the code used in the mod changed since the quoted post was made?  What do I have to change to get my idea to work?

Yes, the code has changed, but it should be even simpler. Just look for

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

instead.

scottws

Quote from: Carceri on August 26, 2006, 05:57:30 AM
Quote from: scottws on August 26, 2006, 12:08:56 AM
Has the code used in the mod changed since the quoted post was made?  What do I have to change to get my idea to work?

Yes, the code has changed, but it should be even simpler. Just look for

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

instead.

So, I'm just changing the midnight part, right?

Advertisement: