News:

Wondering if this will always be free?  See why free is better.

Main Menu

Timezones in members list

Started by rob_bb, January 09, 2015, 02:24:50 AM

Previous topic - Next topic

rob_bb

Hi,

I recently installed 2.1 because I had only been using 2.09 for about 2 days and I wanted timezone info for users.  So I found out about 2.1 beta and decided that my little forum can go live from the begging with 2.1.  It's a forum for a gaming group so it's not the end of the world if it crashes etc...

Anyway, I was wondering if I can show the users timezones in the members list?

And as a second bonus question, can I edit the header of the forum to show multiple timezones?  It currently show the server timezone, but I would like to add 2 more if possible but I really do not know where to start looking in the code base?

cheers,

Sagar_king

well I am also facing problem even set timezone for mine still showing incorrect time
http://mobiletek.in Smf 2.1
<hr>
Really Thankful to SMF community members for helping
All people are on this forum have their own website that's cool :D

live627

./Sources/Load.php, find


$select_columns .= ', mem.buddy_list,  mem.additional_groups';

Replace with

$select_columns .= ', mem.buddy_list,  mem.additional_groups,  mem.timezone';

./Sources/Memberlist.php, find

loadTemplate('Memberlist');

Replace with

loadTemplate('Memberlist');
loadLanguage('Profile');


Find

'registered' => array(

Replace with

'timezone' => array(
'label' => $txt['timezone'],
'sort' => array(
'down' => 'mem.timezone DESC',
'up' => 'mem.timezone ASC'
),
),
'registered' => array(


Find

$context['members'][$member]['registered_date'] = strftime('%Y-%m-%d', $context['members'][$member]['registered_timestamp']);

Replace with

$context['members'][$member]['registered_date'] = strftime('%Y-%m-%d', $context['members'][$member]['registered_timestamp']);
$tz = smf_list_timezones();
$context['members'][$member]['timezone'] = $tz[$context['members'][$member]['timezone']];


./Themes/default/Memberlist.template.php, find

<td class="lefttext reg_date">', $member['registered_date'], '</td>';

Replace with

<td class="lefttext reg_timezone">', $member['timezone'], '</td>
<td class="lefttext reg_date">', $member['registered_date'], '</td>';




Your second question confused me.

Quote from: Sagar_king on January 09, 2015, 03:19:33 AM
well I am also facing problem even set timezone for mine still showing incorrect time
Please open a new topic.

rob_bb

Quote from: Sagar_king on January 09, 2015, 03:19:33 AM
well I am also facing problem even set timezone for mine still showing incorrect time

I have direct access to the hardware mine is running on (it sits next to my main PC) so I know the server has the correct timezone set for it :-)

rob_bb

Ok, that mostly worked except instead of a timezone I get (Forum Default) for every one, although not all users had their zone set.  So I tried to change mine, and randomly changed it to Hawaii and got this error:

Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (America/Honolulu)' in /var/www/thks.great-ape.co.nz/public_html/smf/Sources/Load.php:427 Stack trace: #0 /var/www/thks.great-ape.co.nz/public_html/smf/Sources/Load.php(427): DateTimeZone->__construct('America/Honolul...') #1 /var/www/thks.great-ape.co.nz/public_html/smf/index.php(179): loadUserSettings() #2 /var/www/thks.great-ape.co.nz/public_html/smf/index.php(154): smf_main() #3 {main} thrown in /var/www/thks.great-ape.co.nz/public_html/smf/Sources/Load.php on line 427

I changed it back in the database (to Pacific/Auckland) and it is all working again apart from all timezones show as Forum Default.

I did some searching and found that is should be Pacific/Honolulu as Hawaii is not actually in America.  http://php.net/manual/en/timezones.america.php [nofollow]


Cheers,

lc62003

Quote from: Sagar_king on January 09, 2015, 03:19:33 AM
well I am also facing problem even set timezone for mine still showing incorrect time


Dumb question but have you set the timezone in your own profile?   ;)  Perhaps profile timezones should default to the forum default rather than the first on the dropdown list.   O:)

rob_bb

Quote from: lc62003 on January 09, 2015, 07:24:38 AM
Quote from: Sagar_king on January 09, 2015, 03:19:33 AM
well I am also facing problem even set timezone for mine still showing incorrect time


Dumb question but have you set the timezone in your own profile?   ;)  Perhaps profile timezones should default to the forum default rather than the first on the dropdown list.   O:)


I don't know what sugar king is doing but it looks like users are defaulting to a timezone of UTC is none is set.

live627

Quote from: rob_bb on January 09, 2015, 06:03:23 AMSo I tried to change mine, and randomly changed it to Hawaii and got this error:

Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (America/Honolulu)' in /var/www/thks.great-ape.co.nz/public_html/smf/Sources/Load.php:427 Stack trace: #0 /var/www/thks.great-ape.co.nz/public_html/smf/Sources/Load.php(427): DateTimeZone->__construct('America/Honolul...') #1 /var/www/thks.great-ape.co.nz/public_html/smf/index.php(179): loadUserSettings() #2 /var/www/thks.great-ape.co.nz/public_html/smf/index.php(154): smf_main() #3 {main} thrown in /var/www/thks.great-ape.co.nz/public_html/smf/Sources/Load.php on line 427
Thanks for the report.

https://github.com/SimpleMachines/SMF2.1/commit/8e645c57e452e4a55b3d0d6406145c6f1a0f74ec

rob_bb

Quote from: live627 on January 09, 2015, 11:35:43 PM
Quote from: rob_bb on January 09, 2015, 06:03:23 AMSo I tried to change mine, and randomly changed it to Hawaii and got this error:

Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (America/Honolulu)' in /var/www/thks.great-ape.co.nz/public_html/smf/Sources/Load.php:427 Stack trace: #0 /var/www/thks.great-ape.co.nz/public_html/smf/Sources/Load.php(427): DateTimeZone->__construct('America/Honolul...') #1 /var/www/thks.great-ape.co.nz/public_html/smf/index.php(179): loadUserSettings() #2 /var/www/thks.great-ape.co.nz/public_html/smf/index.php(154): smf_main() #3 {main} thrown in /var/www/thks.great-ape.co.nz/public_html/smf/Sources/Load.php on line 427
Thanks for the report.

https://github.com/SimpleMachines/SMF2.1/commit/8e645c57e452e4a55b3d0d6406145c6f1a0f74ec [nofollow]

Every little bit helps.   Any idea regarding the timezones not showing in the list and instead showing as "(Forum Default)"



Advertisement: