Version: 1.00, by Boofo
Developer Last Online: Jun 2012
Version: 3.0.0
Rating:
Released: 01-27-2004
Last Update: Never
Installs: 25
No support by the author.
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.
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
Ok, if you make those same changes in the other code, it should work like that everywhere the code is. I will update the install file as soon as I hear back from Zelda-King to make sure it fixed it for him also. Thank you everyone for your patience and understanding. I had not run into this problem on my site yet. Glad we found it now.
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.
In the private.php, you need to replace the code with:
PHP Code:
// Local Date and Time in PM $pm['tzoffset'] = $pm['timezoneoffset']; if ($pm['dstonoff']) { // DST is on, add an hour $pm['tzoffset']++; } $pm['localtime'] = date($vboptions['timeformat'], TIMENOW+($pm['tzoffset']-$vboptions['timeoffset'])*3600); $pm['localdate'] = date($vboptions['dateformat'], TIMENOW+($pm['tzoffset']-$vboptions['timeoffset'])*3600); // Local Date and Time in PM
* First post has been updated with all the new code. *
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.
Boofo: sorry to pop back up again, but in Hybrid and Threaded modes, for some reason the template edit is there, but the values of $post[localdate] and $post[localtime] are empty ...
Boofo: sorry to pop back up again, but in Hybrid and Threaded modes, for some reason the template edit is there, but the values of $post[localdate] and $post[localtime] are empty ...
You got me there. I don't use anything but linear mode. I would say do a condition checking for those modes and only allow it in linear. Otherwise, I will take a look at it and see if I can figure something out for it.
Natch, I think I may have your solution. In the showthread.php:
Find:
PHP Code:
$post = $postarray["$id"];
AFTER it add:
PHP Code:
// Local Date and Time in Post $post['tzoffset'] = $post['timezoneoffset']; if ($post['dstonoff']) { // DST is on, add an hour $post['tzoffset']++; } $post['localtime'] = date($vboptions['timeformat'], TIMENOW+($post['tzoffset']-$vboptions['timeoffset'])*3600); $post['localdate'] = date($vboptions['dateformat'], TIMENOW+($post['tzoffset']-$vboptions['timeoffset'])*3600); // Local Date and Time in Post
and let me know if that fixes it for both of them.