![]() |
Local time and date in post, pm, usernotes and profile v1.5
Local time and date in post, pm, usernotes and profile
Version 1.5 (By Boofo) This hack will add the local time and date of users in the posts, pms, usernotes and profile. That way you will know what the time and date is where they are located. I use this on my site so I will have an idea if it is the middle of the night, where they are at, or daytime. With your users living in all corners of the globe, this hack is a nice gauge of the different time zones without having to figure out each one in your head. ;) Thanks goes out to Link14716 for pointing me in the right direction for the pm time and helping to verify the code. And everyone who chipped in at vbulletin.com to help me figure out vB3's new ways of doing things. A special thanks goes out to Chen Avinadav for making the first local time hack for vB2 and allowing me to release it for vB3. ;) Version Information: Version 1.0 --Initial release Version 1.1 --Fixed bug where the User CP DST setting was not being accounted for. Thanks goes out to squall14716 for the fix. ;) Version 1.2 --Fixed bug where a few people's time was off by an hour or two in the showthread, but right on target everywhere else. Moved the code from the showthread.php into the functions_showthread.php, where it should have been in the first place. Thanks Natch, for all of your hard work in helping me track this down. ;) Version 1.3 --Fixed bug where local time and date was not showing up in a member's profile when the "Additional Information" box was empty due to them not entering any personal information in their profile. It would only show an N/A. Version 1.4 --Added ability to have the local time and date to also show up in the showpost. Version 1.5 --Fixed last known bug where the User CP DST setting was not being automatically accounted for when the DST changed. The Version 1.1 fix seemed to be only temporary and not a total solution. This should take care of it. ;) Files to edit: 4 functions_showthread.php private.php usernote.php member.php Templates to edit: 3 postbit postbit_legacy memberinfo If you find this hack useful, please click the install button. |
Yeah i loved this on vB2, was very handy. Thank you for the conversion!
|
thanks !! good job
|
You are both very welcome. ;)
|
At the moment I've just installed the 'user profile' bits (member.php and the MEMBERINFO template). Those with offset -5 (EST) seem OK but I, being GMT (offset 0) am showing up 2 hours behind and someone with offset -6 is showing as offset -8.
|
Quote:
If everything is set right on your end, try this and let me know what happens. change PHP Code:
PHP Code:
|
Quote:
|
Quote:
|
Quote:
|
Quote:
|
It is at the end of these lines (highlighted in yellow):
// Local Date and Time in Profile $post['localtime'] = date($vboptions['timeformat'], TIMENOW+($post['timezoneoffset']-$vboptions['timeoffset'])*3600); $post['localdate'] = date($vboptions['dateformat'], TIMENOW+($post['timezoneoffset']-$vboptions['timeoffset'])*3600); // Local Date and Time in Profile |
Quote:
Local Time: 11:49 AM Local Date: 12-13-2006 (Actual time being 06:49pm) |
Quote:
|
With my offset as 0;
Local Time: 04:59 PM Local Date: 01-28-2004 Actual local time being 06:59pm. For the record, I have my DST settings set to be automatically detected. |
Quote:
Enable Daylight Savings (dstonoff) |
Yes I did. Enabling it hasn't changed anything though, apparantly. My time is still two hours behind.
|
That's really strange, because I have been running it on my forums for 3 weeks now and it has never faltered once. I wanted to thoroughly test it before I released it.
I will look at the code and figure out what is going on. I will post a fix here shortly. Please bear with me. I WILL get this working for you. ;) Is everyone else having the same problem? |
Yup - like I said mine is one hour out for me (and I am in DST)
|
Ok. Try this for the code in the member.php and let me know if it fixes it in the profile. If it does, I will change the rest of the code and get it to you.
In member.php, replace: PHP Code:
PHP Code:
|
You - sir - are a gentleman and a scholar :)
That's done the trick :D :D |
Quote:
BTW: The true credit for this fix goes to squall14716. Without his help, I would still be tearing what little hair I have left out. ;) |
But with those edit's it's all good :) Great work!
('cept private.php - that's now 1 hr over ...) |
Quote:
PHP Code:
|
Please excuse my n00bish-ness ...
Thanks for the update :) Great job - all cool now :) |
Great! And don't worry about being a newbie. We have all been there and some of us still go there from time to time. ;)
Glad it's working for you, now. ;) |
Nice one Boofo! :)
|
Thank you, my friend. ;)
|
Quote:
|
Quote:
|
Natch, I think I may have your solution. In the showthread.php:
Find: PHP Code:
PHP Code:
|
It's fixed it up, but it's out of sync again (1 hour behind) ...
|
Are you sure? It shows the same time for all 3 on my site. That shouldn't have changed anything for the DST. Try moving the code below this line then:
PHP Code:
|
Should I have two copies of this code ? or just one ?
|
Quote:
|
OK - moved that code down ...
EDIT: still one hour too early. |
How does it show in linear mode? It was working fine there before, right? Is it still working ok there?
|
The fix has made it 3 hours (as opposed to the original 2) behind for me and EST has gone back 2 hours.
|
Quote:
|
OT: Do I have to monitor/change the server time for DST as well ?
|
Quote:
|
All times are GMT. The time now is 01:56 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|