View Full Version : Local time and date in post, pm, usernotes and profile v1.5
Boofo
01-27-2004, 10:00 PM
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.
MindTrix
01-28-2004, 02:38 PM
Yeah i loved this on vB2, was very handy. Thank you for the conversion!
nhochochack
01-28-2004, 02:44 PM
thanks !! good job
Boofo
01-28-2004, 03:03 PM
You are both very welcome. ;)
Zelda-King
01-28-2004, 03:16 PM
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.
Boofo
01-28-2004, 03:41 PM
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.What is your server time set to in the Admin CP? And do you have the DST settings right for your server time? Let me know what that is set at and I will test it here on my setup. It is running true to form for me so it might just be a setting off somewhere.
If everything is set right on your end, try this and let me know what happens.
change
$vboptions['timeoffset']
to
$vboptions['hourdiff']
in the code
Natch
01-28-2004, 04:18 PM
What is your server time set to in the Admin CP? And do you have the DST settings right for your server time?
Yup for me, but I'm having an issue as well ... it's working just fine, but it's not taking into account the time offset for DST ...
Boofo
01-28-2004, 04:23 PM
Yup for me, but I'm having an issue as well ... it's working just fine, but it's not taking into account the time offset for DST ...
Do you have your settings in your usercp set to automatically detect DST?
Zelda-King
01-28-2004, 04:23 PM
What is your server time set to in the Admin CP? And do you have the DST settings right for your server time? Let me know what that is set at and I will test it here on my setup. It is running true to form for me so it might just be a setting off somewhere.Last I gathered, the admin CP server time was obsolete and not used any more. I can tell you the Default Time Zone Offset is at the default -5 and I have it all set correctly. Everyone's correct time displays. Just the times in the hack don't tally. Watch this space as I try out the code...
Zelda-King
01-28-2004, 04:30 PM
If everything is set right on your end, try this and let me know what happens.
change
$vboptions['timeoffset']
to
$vboptions['hourdiff']
in the codeWhere is that code? I've only installed the profile bits and that code is not in member.php or MEMBERINFO.
Boofo
01-28-2004, 04:34 PM
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
Zelda-King
01-28-2004, 04:48 PM
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 ProfileAh, so it is. I can only imagine why my first search didn't work. Anyway, the results to that change are disastrous;
Local Time:
11:49 AM
Local Date:
12-13-2006
(Actual time being 06:49pm)
Boofo
01-28-2004, 04:51 PM
Ah, so it is. I can only imagine why my first search didn't work. Anyway, the results to that change are disastrous;
Local Time:
11:49 AM
Local Date:
12-13-2006
(Actual time being 18:49pm)
Ok, I just wanted to be sure it was that far off. ok, with the hack like it is when you go back to the original code, how far off are we?
Zelda-King
01-28-2004, 04:57 PM
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.
Boofo
01-28-2004, 05:10 PM
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.
Ok, in your Admin CP, do you have this set to NO?
Enable Daylight Savings (dstonoff)
Zelda-King
01-28-2004, 05:16 PM
Yes I did. Enabling it hasn't changed anything though, apparantly. My time is still two hours behind.
Boofo
01-28-2004, 05:21 PM
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?
Natch
01-28-2004, 06:57 PM
Yup - like I said mine is one hour out for me (and I am in DST)
Boofo
01-28-2004, 11:42 PM
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:
// 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
with:
// Local Date and Time in Profile
$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 Profile
Natch
01-29-2004, 12:42 AM
You - sir - are a gentleman and a scholar :)
That's done the trick :D :D
Boofo
01-29-2004, 01:02 AM
You - sir - are a gentleman and a scholar :)
That's done the trick :D :D
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. ;)
Natch
01-29-2004, 01:15 AM
But with those edit's it's all good :) Great work!
('cept private.php - that's now 1 hr over ...)
Boofo
01-29-2004, 01:40 AM
But with those edit's it's all good :) Great work!
('cept private.php - that's now 1 hr over ...)In the private.php, you need to replace the code with:
// 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. *
Natch
01-29-2004, 01:44 AM
Please excuse my n00bish-ness ...
Thanks for the update :)
Great job - all cool now :)
Boofo
01-29-2004, 02:13 AM
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. ;)
EvilLS1
01-29-2004, 02:20 AM
Nice one Boofo! :)
Boofo
01-29-2004, 02:31 AM
Thank you, my friend. ;)
Natch
01-29-2004, 03:32 AM
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
01-29-2004, 03:50 AM
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. ;)
Boofo
01-29-2004, 05:17 AM
Natch, I think I may have your solution. In the showthread.php:
Find:
$post = $postarray["$id"];
AFTER it add:
// 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.
Natch
01-29-2004, 05:30 AM
It's fixed it up, but it's out of sync again (1 hour behind) ...
Boofo
01-29-2004, 05:35 AM
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:
$parsed_postcache = array('text' => '', 'images' => 1);
Natch
01-29-2004, 05:52 AM
Should I have two copies of this code ? or just one ?
Boofo
01-29-2004, 06:09 AM
Should I have two copies of this code ? or just one ?
There should be 2 copies in the showthread.php. The original one way up top of the file (from the first fix for the DST) and the new one I just had you add.
Natch
01-29-2004, 06:45 AM
OK - moved that code down ...
EDIT: still one hour too early.
Boofo
01-29-2004, 06:52 AM
How does it show in linear mode? It was working fine there before, right? Is it still working ok there?
Zelda-King
01-29-2004, 02:56 PM
The fix has made it 3 hours (as opposed to the original 2) behind for me and EST has gone back 2 hours.
Boofo
01-29-2004, 10:12 PM
The fix has made it 3 hours (as opposed to the original 2) behind for me and EST has gone back 2 hours.I'm all out of ideas on this one. It seems to work almost everywhere else without problems. I would say there must be some other issue causing this. But, for the life of me, I can't figure out what it is. I will continue to look at the code and see what might be casuing your time problem and see if there is anything I can do. The only thing that comes to mind right now is that your server time in the Admin CP must be off for some reason. This hack relies on that setting being right.
Natch
01-29-2004, 10:24 PM
OT: Do I have to monitor/change the server time for DST as well ?
Link14716
01-29-2004, 11:58 PM
OT: Do I have to monitor/change the server time for DST as well ?
No, I don't believe so.
Boofo
01-30-2004, 01:06 AM
Link is right. All you should need to do is make suure the server is set to the correct timezone and see that DST is set to NO (for now) in the Admin CP. After that it should all be automatic, I think.
Natch, is your linear local time working all right? It was when we fixed it. Is it still ok?
Natch
01-30-2004, 01:17 AM
Link is right. All you should need to do is make suure the server is set to the correct timezone and see that DST is set to NO (for now) in the Admin CP. After that it should all be automatic, I think.
Natch, is your linear local time working all right? It was when we fixed it. Is it still ok?
Sorry mate - but no.
Since the last edit, all of Linear, Hybrid and Threaded modes show the localtime at -1 of what it should be, but in a PM from me, the localtime is accurate.
Boofo
01-30-2004, 01:21 AM
Take the last edit out then until I can look at it more closely and try to figure out what is going wrong. Let me know if the linear time is showing right again after you remove the last code, will you, please?
And how is it in the profile?
Natch
01-30-2004, 01:36 AM
localtime is correct in Profile:
After removing that code, the localtime is still one hour early in showthread...
This is what I still have left in showthread.php - before
$post['musername'] = fetch_musername($post);
$post['islastshown'] = ($post['postid'] == $lastpostid);
$post['attachments'] = &$postattach["$post[postid]"];
I have // 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
Boofo
01-30-2004, 01:43 AM
Didn't you say yesterday that when we added the DST code, that it fixed it for you? And everything was showing the right time? If that was the case, then something happened somewhere when we added the extra code. But that should have fixed itself when we removed it. I'm at a total loss here. This has me totally stumped. On my site the time shows correct in all of the thread display modes, as well as everywhere else. I have had a few people test it on their sites, and they are reporting no time loss or gain.Please double-check everything and see if maybe you left something out somewhere. I don't know how to fix it when it works everywhere else. Anyone else have any ideas?
Natch
01-30-2004, 01:55 AM
Sorry about this pal ... I'll look over this thread again and revert all the files back to prior to this hack - then work it thru ...
Boofo
01-30-2004, 02:05 AM
You don't need to apologize. I just want to help you get it working like it does for me and a lot of others. ;)
The file in the first post has all of the updates that you should need. It was updated after the DST code. I didn't add the hybred or threaded mode to that one yet until we can figure out what is going on.
Natch
01-30-2004, 02:27 AM
The only thing I can think of is that maybe the Auto-detection of [dstonoff] is not working properly in this file for some reason ...
I'm gonna do a Beyond Compare with the original vb# RC3 showthread ...
I'll let u know what I find out ...
Boofo
01-30-2004, 02:31 AM
Please keep me posted. It seems to work fine for me. Maybe something is different in your file.
Link14716
01-30-2004, 02:33 AM
If everyone is having all of these problems, I'm to the point where I'm about to suggest making a damned duplicate of vbdate that uses $post['timezoneoffset'] or whatever instead of $bbuserinfo['timezoneoffset'].
Natch
01-30-2004, 02:38 AM
well that wasn't helpful - the only change to that file is the one from your attachment - and the time is still out.
Turning DST from auto to on to off changed nothing in Linear mode ...
Natch
01-30-2004, 02:39 AM
Turning DST to off in profile changes the other locations of the hack tho ...
Boofo
01-30-2004, 02:41 AM
Natch, try adding this:
global $vboptions, $post, $timeoffset, $timezoneoffset;
above this:
$post['tzoffset'] = $post['timezoneoffset'];
and let me know if it does anything.
Leave the User CP DST setting to Auto.
Natch
01-30-2004, 02:48 AM
No change mate ...
Boofo
01-30-2004, 02:51 AM
I guess I'm confused why it was working fine for you after we added the DST code and now it doesn't. I'm stumped.
Natch
01-30-2004, 02:53 AM
Me too ... plus the fact that the same exact code works for PM's but not in showthread ...
Natch
01-30-2004, 02:55 AM
http://www.mobileforces.org/forums/showthread.php?t=2129 <- at the bottom of this thread, you can see that the time (now) for me is nearly 1500 hours, but it's actually nearly 1600 hours ...
But in a PM I just sent to myself, it says:[Local Time: 15:50]
[Local Date: 30-01-2004]
Boofo
01-30-2004, 02:55 AM
If everyone is having all of these problems, I'm to the point where I'm about to suggest making a damned duplicate of vbdate that uses $post['timezoneoffset'] or whatever instead of $bbuserinfo['timezoneoffset'].
Matt, this is almost exactly the same code that Chen used for vB2 (except with vB3 variables) so it should work fine for everyone. There are only 2 people who have reported any problems at all with this hack. Which is starting to lead me to believe that it isn't the hack as much as maybe another hack they have installed messing with it. Or a setting off somewhere. If you have any ideas, I'm willing to listen.
Boofo
01-30-2004, 02:58 AM
http://www.mobileforces.org/forums/showthread.php?t=2129 <- at the bottom of this thread, you can see that the time (now) for me is nearly 1500 hours, but it's actually nearly 1600 hours ...
But in a PM I just sent to myself, it says:[Local Time: 15:50]
[Local Date: 30-01-2004]
But it was working fine for you before we messed with the second instance of code. In my showthread, it reports everyone's time as what it actually is. I don't think it's the showthread.php.
Boofo
01-30-2004, 03:11 AM
Natch, if you're up for it, I have one last thing to try. Take all of the code you added for this hack out of the showthread.php. Now, open up the functions_showthread.php and find:
// format date/time
$post['postdate'] = vbdate($vboptions['dateformat'], $post['dateline'], true);
$post['posttime'] = vbdate($vboptions['timeformat'], $post['dateline']);
and below it add:
// 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 everything.
Natch
01-30-2004, 03:13 AM
If I take out the new code, and put in the old code it generates exactly the same time regardless ...
Boofo
01-30-2004, 03:15 AM
Did you take it out of the showthread.php and put it in the functions_showthread.php?
Natch
01-30-2004, 03:20 AM
I just did that - and it's right on the money :)
Linear, Hybrid and Threaded modes all ok :)
Great work Boofo!
Natch
01-30-2004, 03:22 AM
https://vborg.vbsupport.ru/external/2004/08/6.gif
Boofo
01-30-2004, 03:25 AM
Now please, double check everything again, pm, profile, everything and let me know if everything is kosher now. I'll explain my mistake after I hear back from you. ;)
Oh, and make sure there is no code for this hack anywhere in the showthread.php now.
Natch
01-30-2004, 03:30 AM
All good Boofo :) https://vborg.vbsupport.ru/external/2004/08/6.gif again!
Check: showthread.php has no mods at all, it's the changes in includes/functions_showthread.php that do the trick :)
Boofo
01-30-2004, 03:42 AM
Great! And thank you for bearing with me on this. I couldn't have done it without you. I will update the first post with the changes now. This should fix it for anyone else that has had any problems.
BTW: I gave you credit for all of your hard work in helping me track this down. Thank you very much, sir. Now I can get to work on my other hacks for my site. ;)
Natch
01-30-2004, 03:46 AM
* Natch blushes ...
Looking forward to your work again ... and I appreciate your patience on the support :D
Boofo
01-30-2004, 03:53 AM
Anytime, my firend. You are one heck of a beta tester. ;)
Stop by the site and register and I'll show you some of what I am working on now. The site's pretty dead, but I can get more coding done that way. ;)
Zelda-King
01-30-2004, 06:18 AM
Matt, this is almost exactly the same code that Chen used for vB2 (except with vB3 variables) so it should work fine for everyone. There are only 2 people who have reported any problems at all with this hack. Which is starting to lead me to believe that it isn't the hack as much as maybe another hack they have installed messing with it. Or a setting off somewhere. If you have any ideas, I'm willing to listen.That's possible I suppose. I have the User Forum Activeness hack installed. That's the only hack I'm using in member.php though.
Boofo, if you like, I could set you up with a temporary admin account on my board so you can have a looksee...
Boofo
01-30-2004, 06:23 AM
Have you tried the code anywhere else? Can you install it for the pms and postbits and see if it is working right there? that might help us to narrow it down at least. The file in the first post has been updated with all of the changes.
Zelda-King
01-30-2004, 02:51 PM
OK I did that but I'm still getting the same times in PMs, usernotes and posts as I get in profiles... and that was after cleaning my cache and downloading the file about 15 minutes before this post was made.
Boofo
01-30-2004, 10:29 PM
If you downloaded and installed the new code for the functions_showthread.php, and it is still off, then I'm beginning to believe it has to be your server time setting is off in the Admin CP. With the new code changes, how far off are we still?
Zelda-King
01-31-2004, 12:25 AM
As far as I'm aware, as I've said before, there is no longer such an option (vBulletin doesn't need that manually set in the admin cp any more) and in any case everyone's regular vB times show correctly. Could you point me exactly where you mean please.
Boofo
01-31-2004, 12:29 AM
Default Time Zone Offset in the Date and Time Options in the Admin CP under vBulletin Options. ;)
Zelda-King
01-31-2004, 12:38 AM
Ah yes. I knew about that but that's not server time. Mine is set at -5 and I've said I can't give you a straight 'how many hours out' reply because it is different for each timezone. ie, EST is correct.
Zelda-King
01-31-2004, 12:45 AM
Disregard my last post. I've spotted something different. Times are now all 2 hours behind.
Boofo
01-31-2004, 01:49 AM
What did you spot? Maybe it is interfering with this?
Where are you located and is DST in effect there right now?
Zelda-King
01-31-2004, 01:52 AM
No, it's just the update. Before the times screwed up pending on area and now they're all 2 hours behind.
Boofo
01-31-2004, 01:59 AM
Try turning DST off in the Admin CP and make sure it is set to Automatically detec DST settings in YOUR user cp and tell me if that does anything.
Don't lose faith. We'll get it working for you. Everyone else seems to be all fixed up. We'll get you there, too. ;)
Zelda-King
01-31-2004, 02:34 AM
Naw, I'm more bothered about giving you more grief. Well those settings don't change the times. :/ I set it up as you said.
Boofo
01-31-2004, 03:26 AM
Set me up a test account and set the timezone to CST (Central standard time) and let me take a look around. ;)
Zelda-King
01-31-2004, 11:45 AM
For the sake of this thread: After our testing it turned out that setting the default timezone DOES affect it and varies from server to server, so the fault was mine. The hack is working fine now.
Boofo
01-31-2004, 11:59 AM
I'm just glad it was an easy fix and we could get it working for you. ;)
Zelda-King
01-31-2004, 12:05 PM
Yes, now I can finally apply it to my other 8 styles.
Boofo
01-31-2004, 12:16 PM
Go for it and enjoy! ;)
Dark Shogun
02-09-2004, 02:08 PM
Boofo for some reason when I installed this and check my profile and threads it says that my local time is 6:07am when in fact it is 11:07am. I updated with your newest attachment. Do you know why that is?
Dark Shogun
Boofo
02-09-2004, 10:33 PM
Either you don't have the server time setting in your Admin CP correct or you don't have you timezone correct in your User CP. Those are the only 2 things it could be.
Dark Shogun
02-09-2004, 11:07 PM
Couldn't be either of those because the time on the bottom of the forum is right.
Dark Shogun
Boofo
02-10-2004, 01:57 AM
That time does not go off of server time. Chnage your server time and you will see what I mean. This hack DOES rely on those settings being correct. Read above what Zelda_king had to say about getting it to show the right time. ;)
leitel
03-18-2004, 11:44 PM
That time does not go off of server time. Chnage your server time and you will see what I mean. This hack DOES rely on those settings being correct. Read above what Zelda_king had to say about getting it to show the right time. ;)
I have my own portal front page of sorts (staging site at www.noblood.org/staging/). I would like to display user local time on front page. Can I place the lines of code you direct to be placed in functions_showthread.php in global.php instead?
Thanks! :)
Boofo
03-19-2004, 01:02 AM
I'm not sure. I've never tried it. Try it and let me know what happens. If it doesn't work, we'll get it to work for you. How's that for support? ;)
And please click the install button. ;)
leitel
03-19-2004, 01:31 AM
I'm not sure. I've never tried it. Try it and let me know what happens. If it doesn't work, we'll get it to work for you. How's that for support? ;)
And please click the install button. ;)
It appears that if you have a custom front page where you want to show users' local time, putting your functions_showthread.php code in global will work. I actually have my own functions file for items that need to appear on my front page. I also ltrimmed the zero of the time as well:
if ($UserTime[0]=='0') {$UserTime = substr( $UserTime, 1);}
if ($pmbox[lastvisittime][0]=='0') {$pmbox[lastvisittime] = substr( $pmbox[lastvisittime], 1);}
Something that occurs to me would be to impliment the same approach for Last Visited date and time for consistancy.
On my current 'staging' area I have in my header:
Welcome: LarryEitel
From: La Asunci?n de Bel?n Heredia Costa Rica
Your time: 03-18-2004 (10:24 PM)
You last visited: Today at: 8:01 PM
Since I'm so close to my actual server time zone, no big prob. But what if they see their local time and then the last time they visited majorly skewed?
By the way, I realize that your hack was intended for showing the local time the POST was made. I will install this when vB goes Gold. I am trying to promote users to revise their timezone by showing their local time and then if they see it is incorrect, they are 'encouraged' to revise.
leitel
03-23-2004, 02:04 PM
I have adapted your hack to show a user HIS local time. For some reason, although I have verified server time AND my timezone, I continue to show one hour ahead.
Is anyone else doing this on their site? If so, what am I doing wrong?
Thanks! :)
// Local Date and Time
$bbuserinfo['tzoffset'] = $bbuserinfo['timezoneoffset'];
if ($bbuserinfo['dstonoff'])
{
// DST is on, add an hour
$bbuserinfo['tzoffset']++;
}
$UserTime = date($vboptions['timeformat'], TIMENOW+($bbuserinfo['tzoffset']-$vboptions['timeoffset'])*3600);
$UserDate = date($vboptions['dateformat'], TIMENOW+($bbuserinfo['tzoffset']-$vboptions['timeoffset'])*3600);
// Local Date and Time
if ($UserTime[0]=='0') {$UserTime = substr( $UserTime, 1);}
Boofo
03-23-2004, 08:41 PM
Have you checked to make sure this setting in the Date and Time Options in the vBulletin Settings is set correctly?
Enable Daylight Savings
leitel
03-23-2004, 10:06 PM
Thanks for replying. I verified that they are enabled. I looked at another vB2x version and it uses the same formula. Strange. I could hard-wire minus one hour I suppose. :(
Boofo
03-23-2004, 10:15 PM
Where are you located? In the US here DST is NOT enabled right now. ;) That would be the rpoblem if you have it enabled in the Admin CP.
leitel
03-23-2004, 10:23 PM
I just turned OFF DST. And although at the present moment, I have hard-wired minus one hour, my local time is still the same. It makes me question the time on the server.
I have a dedicated server at ServerMatrix. I believe it is actually in Dallas. Server control panel has way to sync correct time. So it is difficult to point the finger at the time on the server.
In the meantime, I'll leave it hardwired to make up for the one hour difference. :(
Boofo
03-23-2004, 10:28 PM
Well, the only way the time is correct with this hack is the server time has to be correct with what time the server is set at. It won't work any other way. I am in the process of re-writing this hack to ignore the server time and always go off of GMT, so bear with me while I sort this out and we will get it working for you like the time does now in vB3 Gold. ;)
Gary King
04-03-2004, 01:09 AM
This hack doesn't seem to be working for me, the time shown is 8 hours ahead of the real time (when checking my own post 'Local Time').
Also, shouldn't this hack have support for phrases?
I think this hack belongs in the Beta Hacks forum still, until it gets fixed ;)
Boofo
04-03-2004, 05:38 AM
This hack doesn't seem to be working for me, the time shown is 8 hours ahead of the real time (when checking my own post 'Local Time').
Also, shouldn't this hack have support for phrases?
I think this hack belongs in the Beta Hacks forum still, until it gets fixed ;)
This hack goes off of the server time so if your setting in the Admin CP vBulletin Options is not set to the correct server time, it will be off. Please read the thread before makiing assumptions.
https://vborg.vbsupport.ru/showpost.php?p=471234&postcount=83
If you want phrase support, you are more then welcome to make whatever phrases you need.
This hack is working for me and everyone else that has installed it, so, no, it doesn't belong on beta. I think you're thinking about most of YOUR hacks, Gary.
Gary King
04-03-2004, 01:24 PM
Why do you always have to make things so personal? If you want to move my hacks to Beta hacks, then that's fine with me. As you have seen in ALL my previous posts (except my last one in this thread) when I was talking to you, I have tried to steer away from the path of having a personal fight, while you kept on walking right back on that path.
If you want to move my hacks to Beta releases now, since you are now a mod, then I don't mind at all. I release hacks because people request them and want them; if someone wants to do something about it, maybe delete some of my hacks because of some silly reasons that they can come up with, then sure go ahead; they'd also be taking away a hack that at least one person would really love to have on their forums. Yes probably some of my hacks are small, but they do their jobs.
--------------------
Anyhow, back on topic, this hack, I have my server settings set properly in my admin cp, and my timezone is obviously set correctly in my user cp.
I read your last post in this thread and you talked about several improvements that you could make to this hack, so I don't see what you mean by this hack working well, especially not for everyone.
Take a look at these posts:
https://vborg.vbsupport.ru/showpost.php?p=488866&postcount=98
https://vborg.vbsupport.ru/showpost.php?p=474751&postcount=87
Anyhow, not too many posts I could get because not many have installed this and/or replied back to this thread.
--------------------
I don't want to play the blame game, if most have seen me, I try not to be rude or point fingers, unlike some people I will not name.
If this post gets deleted, it just goes to show that what has been said in this post really is all true.
Boofo
04-03-2004, 01:49 PM
As far as moving your hacks, me being a mod has no effect on that. I don't move threads to beta hacks. That is up to the higher staff. I'm just a mod, nothing more. As far as this being personal, you made it that way when you jumped in my thread and said I should move this hack to beta when there is no reason to as the hack DOES work if the person installing it has the setting in the Admin CP set to their ACTUAL server time, not just the time the want the new users to see. This hack is the exact same hack as Chen released for vB2 except that the variable names have changed. Now, if it worked so well for vB2, why should it not work the same way for vB3? The only thing different in vB3 is that they no longer user the server timne to get the time. But this hack DOES.
You set your server time to where the server actually is and the hack will work for you. If not, then don't install it. You didn't hit the install button anyway, so what does it matter?
Now, if you want help getting this hack to work, I will put any contempt I have for you aside and help you get the hack to work. I support my hacks and I get them fixed if someone has problems. You included. It's up to you, but don't tell me my hack doesn't work because you are having problems with it. How many times have you run into the same thing and found out it was an install error or someone didn't follow instructions properly?
And if not to many people have replied to the thread, that must mean it is working for those people, huh? ;)
If you want to carry this further, take it to pm.
Boofo
04-07-2004, 10:16 AM
Anyone having problems with the time being off an hour after the DST change needs to make the following update to this hack.
Thnak goes out to NTLDR for coming up with the correct fix. ;)
functions_showthread.php
usernote.php
member.php
find:
$post['tzoffset'] = $post['timezoneoffset'];
if ($post['dstonoff'])
{
// DST is on, add an hour
$post['tzoffset']++;
}REPLACE it with:
$post['tzoffset'] = $post['timezoneoffset'];
if (!$post['dstonoff']) {
$post['tzoffset']--;
}In private.php find:
$pm['tzoffset'] = $pm['timezoneoffset'];
if ($pm['dstonoff'])
{
// DST is on, add an hour
$pm['tzoffset']++;
}REPLACE it with:
$pm['tzoffset'] = $pm['timezoneoffset'];
if (!$pm['dstonoff']) {
$pm['tzoffset']--;
}
*waits ever-so-patiently for 'goes of setting time, not server time version*
Being that my host is located halfway round the world from me, and with me running a site kinda pointed at locals, things get a little confusicating for people. :)
Boofo
06-25-2004, 02:47 AM
*waits ever-so-patiently for 'goes of setting time, not server time version*
Being that my host is located halfway round the world from me, and with me running a site kinda pointed at locals, things get a little confusicating for people. :)
LOL If you figure out how to do the "setting time", let me know. I'd be interested in that myself.
As long as you have the setting in the Admin CP set to the actual server time, your user's local time will show fine. It does for me and almost everyone else who installed this. ;)
LOL If you figure out how to do the "setting time", let me know. I'd be interested in that myself.
As long as you have the setting in the Admin CP set to the actual server time, your user's local time will show fine. It does for me and almost everyone else who installed this. ;)
Oh, yes, indeed it does.
However, when a NZer comes on as a guest at 12PM and the board says last posts were made at 3AM yesterday, that's what is confusing.
If they're logged in, all is good and works like it should do.
Boofo
06-25-2004, 12:12 PM
Oh, yes, indeed it does.
However, when a NZer comes on as a guest at 12PM and the board says last posts were made at 3AM yesterday, that's what is confusing.
If they're logged in, all is good and works like it should do.
What is your server time set at? -9?
What is your server time set at? -9?
Umm..it was somewhere around there, I changed back to +12 till you work your magic and figure a way around it. ;)
I was thinking of perhaps just sticking the member's timezone selection into the postbit instead for now...
*edit* The server lives in Orlando, FL, USA. I live in AK,New Zealand.
:)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.