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

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
Reply With Quote
  #13  
Old 01-28-2004, 04:48 PM
Zelda-King's Avatar
Zelda-King Zelda-King is offline
 
Join Date: Nov 2002
Location: London, England
Posts: 674
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

Quote:
Originally Posted by Zelda-King
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?
Reply With Quote
  #15  
Old 01-28-2004, 04:57 PM
Zelda-King's Avatar
Zelda-King Zelda-King is offline
 
Join Date: Nov 2002
Location: London, England
Posts: 674
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

Quote:
Originally Posted by Zelda-King
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)
Reply With Quote
  #17  
Old 01-28-2004, 05:16 PM
Zelda-King's Avatar
Zelda-King Zelda-King is offline
 
Join Date: Nov 2002
Location: London, England
Posts: 674
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes I did. Enabling it hasn't changed anything though, apparantly. My time is still two hours behind.
Reply With Quote
  #18  
Old 01-28-2004, 05:21 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #19  
Old 01-28-2004, 06:57 PM
Natch's Avatar
Natch Natch is offline
 
Join Date: Nov 2002
Location: Australia
Posts: 851
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yup - like I said mine is one hour out for me (and I am in DST)
Reply With Quote
  #20  
Old 01-28-2004, 11:42 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:
// 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:

PHP Code:
// 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 
Reply With Quote
  #21  
Old 01-29-2004, 12:42 AM
Natch's Avatar
Natch Natch is offline
 
Join Date: Nov 2002
Location: Australia
Posts: 851
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You - sir - are a gentleman and a scholar

That's done the trick
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:12 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.08514 seconds
  • Memory Usage 2,324KB
  • 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_php
  • (3)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