Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: BaneError - syyskuu 17, 2013, 09:10:15 IP

Otsikko: Users Online Today
Kirjoitti: BaneError - syyskuu 17, 2013, 09:10:15 IP
Hello,

I just installed this Users Online Today (http://custom.simplemachines.org/mods/index.php?mod=217).



I want to modify the above picture's text. So it will say: Users logged in last 24 hours but it will count user that have logged in last week.

It sounds easy but I am afraid to mess with this without a guidance.

Thanks
Otsikko: Re: Users Online Today
Kirjoitti: mashby - syyskuu 17, 2013, 09:30:13 IP
I guess I am rather unclear of what you want. The mod you installed does what it says...users online today. Today doesn't really mean this.
LainaaUsers logged in last 24 hours but it will count user that have logged in last week
Might you be able to further explain what you want?
Otsikko: Re: Users Online Today
Kirjoitti: BaneError - syyskuu 17, 2013, 09:44:20 IP
I want to change this message from "Users logged in last 24 hours" to "Users logged in".
In other words I don't want the users to know when those members logged in, I just want them to show that a lot of members have logged in.
Otsikko: Re: Users Online Today
Kirjoitti: mashby - syyskuu 17, 2013, 09:48:36 IP
Hmm. OK. Seems odd to me but still OK. Have a look in Themes/default/languages
It's likely going to be UsersOnlineToday.english.php or whatever language you are running on your site.
All of the verbiage for that area seems to be in the first few lines:
$txt['uot_users_online_current_day']='Users Logged In Today';
$txt['uot_users_online_last_24_hours']='Users Logged In Last 24 Hours';
$txt['uot_users_online_last_7_days']='Users Logged In Last 7 Days';
Otsikko: Re: Users Online Today
Kirjoitti: BaneError - syyskuu 17, 2013, 09:50:34 IP
I am using a custom theme, will I have any problem?
Also what if i want to change its function from 24 hours to 1 month?
Otsikko: Re: Users Online Today
Kirjoitti: mashby - syyskuu 17, 2013, 09:59:25 IP
Custom theme won't matter. One month? That would be a matter of editing Sources/Subs-UsersOnlineToday.php and adding that as an option. Although I have to say I don't quite get what your goal is. Seems that you want to make your site seem like it's "active" even if it's not?
Otsikko: Re: Users Online Today
Kirjoitti: BaneError - syyskuu 17, 2013, 10:25:00 IP
Yeah something like that.
Can you tell me what I need to add in subs-usersonlinetoday.php in order to make an option for 1 month?

Thanks for your help
Otsikko: Re: Users Online Today
Kirjoitti: mashby - syyskuu 17, 2013, 10:31:12 IP
Add to this fun:
array('select', 'uot_setting_period', array('current_day' => $txt['uot_setting_current_day'], 'last_24_hours' => $txt['uot_setting_last_24_hours'], 'last_7_days' => $txt['uot_setting_last_7_days']), 'preinput' => $txt['uot_setting_period_pre_txt'], 'postinput' => $txt['uot_setting_period_post_txt']),

// There are three periods to choose from.
$allowed_period_options = array(
'current_day',
'last_24_hours',
'last_7_days',
);

// Load the users online during last period.
if ($modSettings['uot_setting_period'] == 'current_day')
{
$date = @getdate(forum_time(false));
$midnight = mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']) - ($modSettings['time_offset'] * 3600);
}
else
{
if ($modSettings['uot_setting_period'] == 'last_24_hours') $midnight = time() - 86400;
elseif ($modSettings['uot_setting_period'] == 'last_7_days') $midnight = time() - 604800;
}
604800 for 30 days is 2592000. There might be more things, but if that's what you're after, you might be better off changing this:
User online time threshold
Admin > Configuration > Features and Options
To the number of minutes in 30 days.

Personally I wouldn't even try this because it's subjective. Not sure of the performance implications of extending it out like that either.
Otsikko: Re: Users Online Today
Kirjoitti: BaneError - syyskuu 17, 2013, 10:42:06 IP
I will not touch the last one.
Thanks for your help!