Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Local time and date in post, pm, usernotes and profile v1.5 Details »»
Local time and date in post, pm, usernotes and profile v1.5
Version: 1.00, by Boofo Boofo is offline
Developer Last Online: Jun 2012 Show Printable Version Email this Page

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.

Comments
  #92  
Old 03-18-2004, 11:44 PM
leitel leitel is offline
 
Join Date: Mar 2003
Location: Costa Rica
Posts: 118
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo
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!
Reply With Quote
  #93  
Old 03-19-2004, 01:02 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #94  
Old 03-19-2004, 01:31 AM
leitel leitel is offline
 
Join Date: Mar 2003
Location: Costa Rica
Posts: 118
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo
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.
Reply With Quote
  #95  
Old 03-23-2004, 02:04 PM
leitel leitel is offline
 
Join Date: Mar 2003
Location: Costa Rica
Posts: 118
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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);}
Reply With Quote
  #96  
Old 03-23-2004, 08:41 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Have you checked to make sure this setting in the Date and Time Options in the vBulletin Settings is set correctly?

Enable Daylight Savings
Reply With Quote
  #97  
Old 03-23-2004, 10:06 PM
leitel leitel is offline
 
Join Date: Mar 2003
Location: Costa Rica
Posts: 118
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #98  
Old 03-23-2004, 10:15 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #99  
Old 03-23-2004, 10:23 PM
leitel leitel is offline
 
Join Date: Mar 2003
Location: Costa Rica
Posts: 118
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #100  
Old 03-23-2004, 10:28 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #101  
Old 04-03-2004, 01:09 AM
Gary King's Avatar
Gary King Gary King is offline
 
Join Date: Jan 2002
Posts: 2,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:25 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
  • Page Generation 0.04552 seconds
  • Memory Usage 2,314KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete