Author Topic: Users Online Today Mod  (Read 383537 times)

Offline Carceri

  • Jr. Member
  • **
  • Posts: 136
  • Gender: Male
Users Online Today Mod
« on: November 06, 2005, 01:42:31 AM »
Link to Mod

Adds a list of all users that were online on the current day to the 'Info Center'.

Version 1.5.6
- Fixed a bug where the time would be incorrectly displayed if the user was last logged in more than 24 hours ago, which only occurred in the last_7_days mode

Version 1.5.5
- Updated to work with the new default "Curve" theme

Version 1.5.4
- Updated for SMF 2.0 Beta 4

Version 1.5.3
- Fixed a bug where the language strings were not initialized properly

Version 1.5.2
- Same as 1.5.1, but for SMF 2.0 Beta 3.1

Version 1.5.1
- Fixed a bug where the number of users was incorrectly displayed if the user didn't have viewing permissions

Version 1.5.0
- Works with SMF 2.0 Beta 3
- Can show users online during the current day, last 24 hours or last 7 days
- User list can be shown only to admin, only to registered users, or to everyone
- User list can be sorted by last seen or alphabetically

Version 1.4.0
- Beta 3 promoted to final without changes

Version 1.4.0 Beta 3
- Corrected wrong text
- Removed duplicate entry in the language file
- Code cleanup

Version 1.4.0 Beta 2
- Users logged in today are not shown to guests

Version 1.4.0 Beta 1
- Text changed to "Users Logged In Today"
- Some cosmetic changes
- Hidden users are now hidden

Version 1.3.1
- Text changed to "Users Seen Today"
- Works with SMF 1.1 RC2

Version 1.3.0
- Changed a text string in the stats center

Version 1.3.0 RC3
- Finally timezones are working as expected

Version 1.3.0 RC2
- Made it possible to display "yesterday" on the popup for users that were online yesterday according to the current user

Version 1.3.0 RC1
- Added the total number of online users for a day to the statistics center
- All daily stats are done using forum time, but the popup text is displayed in the users' local timezone

Version 1.2.0 was never released as final

Version 1.2.0 RC1
- Now handles timezones properly

Version 1.1.2
- Fixed a bug where hidden users were shown in italic
- Hidden users don't show last login time when hovering the mouse over their usernames

Version 1.1.1
- Fixed an error "Undefined index: num_buddies"

Version 1.1
- By hovering the mouse over the username, you can see when the user was last online
- Removed some unnessesary code

Version 1.0
- First version
« Last Edit: January 28, 2010, 03:45:30 PM by Carceri »

Offline Teknomancer

  • Jr. Member
  • **
  • Posts: 139
  • Gender: Male
    • Toons & Comics
Re: Users Online Today Mod
« Reply #1 on: November 06, 2005, 09:46:40 AM »
This doesn't seem to work for me. Just installed it on SMF 1.1. RC1... nothing has changed in the Info Center.

Is there any setting that needs to be enabled?
My SMF Forum:

Offline xenovanis

  • Support Team Mentor
  • Support Specialist
  • SMF Super Hero
  • *
  • Posts: 11,127
  • Gender: Female
    • Taxibalk
Re: Users Online Today Mod
« Reply #2 on: November 06, 2005, 11:13:54 AM »
If you are using a custom theme, you probably need to make some changes to your themefiles.

How to make mods work with themes?
"An idiot could find that code. The cancellation code. And he'd keep on typing, keep on fighting. Anything to save his friends."

Offline snork13

  • SMF Friend
  • Sophist Member
  • *
  • Posts: 1,226
  • Gender: Male
  • so little time
    • simplemachines.org
Re: Users Online Today Mod
« Reply #3 on: November 06, 2005, 05:54:53 PM »
works great in 1.1rc1, thanks for sharing


-snork
Mods
Please DO NOT PM me with requests for individual support, but post your questions and concerns in the appropriate section of the forum where other users can benefit from them as well. Thank you.
I have been busy as of late. Working on updates to all my modifications...hold tight :)

Offline xenovanis

  • Support Team Mentor
  • Support Specialist
  • SMF Super Hero
  • *
  • Posts: 11,127
  • Gender: Female
    • Taxibalk
Re: Users Online Today Mod
« Reply #4 on: November 06, 2005, 06:24:01 PM »
Actually, I got this errormessage:

8: Undefined index: num_buddies
File: .../forum/Sources/BoardIndex.php
Regel: 298

This is how I fixed it. BoardIndex.php

Code: (find) [Select]
        $context['users_online_today'] = array();
$context['list_users_online_today'] = array();

Code: (add after) [Select]
$context['num_buddies'] = array();

Probably a dirty fix  :P
"An idiot could find that code. The cancellation code. And he'd keep on typing, keep on fighting. Anything to save his friends."

Offline Carceri

  • Jr. Member
  • **
  • Posts: 136
  • Gender: Male
Re: Users Online Today Mod
« Reply #5 on: November 06, 2005, 07:33:16 PM »
You are right that this is a bug, and the correct fix is not adding the line that uses $context['num_buddies'] which is:

$context['num_buddies']++;

Your fix works as well, but should be

$context['num_buddies'] = 0;

:)

Thanks for reporting it. It has been fixed in the latest version.
« Last Edit: November 06, 2005, 07:48:44 PM by Carceri »

Offline thetzfreak

  • Jr. Member
  • **
  • Posts: 103
Re: Users Online Today Mod
« Reply #6 on: November 06, 2005, 09:55:34 PM »
Do I have to do the custom editing thing for my theme even after you updated it now?

Offline Carceri

  • Jr. Member
  • **
  • Posts: 136
  • Gender: Male
Re: Users Online Today Mod
« Reply #7 on: November 07, 2005, 01:34:47 AM »
Do I have to do the custom editing thing for my theme even after you updated it now?
If you have a file called 'BoardIndex.template.php' in your theme dir, then you need to edit it manually. This mod only edits it for the default theme.

Offline jerm

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 7,152
Re: Users Online Today Mod
« Reply #8 on: November 07, 2005, 04:01:11 PM »
lol, just realized it
with the other online users mod it wasn't a huge deal, but with this one it can be a bigger deal i guess
but for those users who like to remain hidden, they hide in the "users online", but they arn't hidden on the "users online today" section.. and now you can just hover over their nickname to see when they were last active.
think theres a fix for this?

Offline Carceri

  • Jr. Member
  • **
  • Posts: 136
  • Gender: Male
Re: Users Online Today Mod
« Reply #9 on: November 07, 2005, 04:23:03 PM »
It's easy to make a fix. The question is what the right fix is :)

Just a question: What happens if you go to a profile of a user who does not want to be shown on the today list. Can you still see when that user was last logged in? If yes, then I think this mod does not reveal any more information that what could already be found elsewhere and I think it should be left as it is.

If that information is not shown in the users profile, then we should probably do something. The easy fix is to simply remove the user from the list and add some additional text like:

13 users online today (3 hidden):
<<13 usernames of non-hidden users>>

Suggestions?

Offline xenovanis

  • Support Team Mentor
  • Support Specialist
  • SMF Super Hero
  • *
  • Posts: 11,127
  • Gender: Female
    • Taxibalk
Re: Users Online Today Mod
« Reply #10 on: November 07, 2005, 04:26:28 PM »
I think it's okay to show them in the list, but not in an italic font. Now, you can see all hidden users easily.
"An idiot could find that code. The cancellation code. And he'd keep on typing, keep on fighting. Anything to save his friends."

Offline Carceri

  • Jr. Member
  • **
  • Posts: 136
  • Gender: Male
Re: Users Online Today Mod
« Reply #11 on: November 07, 2005, 04:32:08 PM »
Are the hidden users shown with an italic font? I have never noticed that, but perhaps it's because I'm an administrator on the board?

Offline xenovanis

  • Support Team Mentor
  • Support Specialist
  • SMF Super Hero
  • *
  • Posts: 11,127
  • Gender: Female
    • Taxibalk
Re: Users Online Today Mod
« Reply #12 on: November 07, 2005, 04:38:36 PM »
Yes, in the online list their names are shown in italic font to administrators. Normal users can't see they are online.

In your mod, their names also appear in a italic font, but they are now also visible like this to other users. It's like drawing extra attention to them IMO. I found this in BoardIndex.php
Code: [Select]
$context['list_users_online_today'][$row['lastLogin'] . $row['memberName']] = empty($row['showOnline']) ? ' <i>' . $link . ' </i>' : $link; and removed the <i> tags to normalize the font.
"An idiot could find that code. The cancellation code. And he'd keep on typing, keep on fighting. Anything to save his friends."

Offline Carceri

  • Jr. Member
  • **
  • Posts: 136
  • Gender: Male
Re: Users Online Today Mod
« Reply #13 on: November 07, 2005, 04:41:30 PM »
Yes, but it is the same code that apparently hides them from regular users in the users online list. I will have to investigate why the same code hides the users from the online list, but not the online today list.

Then I will make the correct fix.

Offline xenovanis

  • Support Team Mentor
  • Support Specialist
  • SMF Super Hero
  • *
  • Posts: 11,127
  • Gender: Female
    • Taxibalk
Re: Users Online Today Mod
« Reply #14 on: November 07, 2005, 04:42:06 PM »
No, it doesn't. I tested it. This works correct  ;)
"An idiot could find that code. The cancellation code. And he'd keep on typing, keep on fighting. Anything to save his friends."

Offline Carceri

  • Jr. Member
  • **
  • Posts: 136
  • Gender: Male
Re: Users Online Today Mod
« Reply #15 on: November 07, 2005, 04:47:11 PM »
Sorry, what works correct?

Offline xenovanis

  • Support Team Mentor
  • Support Specialist
  • SMF Super Hero
  • *
  • Posts: 11,127
  • Gender: Female
    • Taxibalk
Re: Users Online Today Mod
« Reply #16 on: November 07, 2005, 04:49:41 PM »
Removing the <i> tags keeps the users hidden (or italic to admins) in the current online list, and shows hidden users in a normal font in the online today list.
"An idiot could find that code. The cancellation code. And he'd keep on typing, keep on fighting. Anything to save his friends."

Offline Carceri

  • Jr. Member
  • **
  • Posts: 136
  • Gender: Male
Re: Users Online Today Mod
« Reply #17 on: November 07, 2005, 04:55:04 PM »
I don't quite understand this. Are you saying that this mod modifies the behaviour of the current online list?

Offline xenovanis

  • Support Team Mentor
  • Support Specialist
  • SMF Super Hero
  • *
  • Posts: 11,127
  • Gender: Female
    • Taxibalk
Re: Users Online Today Mod
« Reply #18 on: November 07, 2005, 05:01:11 PM »
No, it doesn't affect the current online list. Sorry for the confusion.  :-\

But it does show to ordinary members whether a member has choosen to be hidden, by displaying it's username in an italic font in the "users online today" list. I think you should get rid of that, because it's drawing extra attention to this profile. People start wondering why this name is italicized and their own name isn't.
"An idiot could find that code. The cancellation code. And he'd keep on typing, keep on fighting. Anything to save his friends."

Offline Carceri

  • Jr. Member
  • **
  • Posts: 136
  • Gender: Male
Re: Users Online Today Mod
« Reply #19 on: November 07, 2005, 05:04:30 PM »
My confusion comes from your answer to my comment where I said that I needed to investigate this, because from looking at the code my first impression is that everything works as it should, and I understood that you said that I should't look at the code because everything works ok. Now I understand again :)

While removing the <i> might work, I don't think this is the correct fix. Something else is wrong here, and I am hesistant to make a fix before I really understand what I am fixing :)