Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons

Reply
 
Thread Tools
User Defined Date & Time Format Display Details »»
User Defined Date & Time Format Display
Version: 1.0.0, by eoc_Jason eoc_Jason is offline
Developer Last Online: Jan 2020 Show Printable Version Email this Page

Version: 3.5.0 Rating:
Released: 10-02-2005 Last Update: Never Installs: 40
Uses Plugins
 
No support by the author.

User Defined Date & Time Format Display

This is a simple add-in that allows your users to select a US / European date and time format. The "vB" way is supposed to be copying the languages and then setting defaults, but I find this as a much easier and cleaner alternative.

Date Formats:
- US Format
- Expanded US Format
- European Format
- Expanded European Format

Time Formats:
- 12-Hour Time Format
- 24-Hour Time Format

Read the text file as you will need to create two additional user fields. The XML file will create the actual plugin, however it will need to be modified to match up with the two "just created" user fields.

No further modifications are needed. All date / time displays will then be in whatever format the user chooses via their options.

Image attached of UserCP Options. Setting these will globally change any date / time display on the forum (for that user).

Changelog
v1.0.0 - Initial Release

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #22  
Old 05-25-2009, 04:23 PM
Dunhamzzz Dunhamzzz is offline
 
Join Date: Jul 2008
Location: Hampshire, UK
Posts: 54
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I second the above post. Need a 3.8 version!
Reply With Quote
  #23  
Old 09-08-2009, 07:21 PM
rsuplido rsuplido is offline
 
Join Date: May 2002
Posts: 114
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This will work on 3.8. Don't upload the XML. Just add the plugin directly using 'Add New Plugin' at the CP.

Product: vbuletin
Hook Location: global_start
Title: Custom Date & Time Formats
Execution Order: 5 - I don't know if this needs to be changed but 5 works fine on mine.
Plugin PHP Code:
PHP Code:
if ($vbulletin->userinfo['userid']) {
    
// ############ Date Format as Uservalue ################
    
switch ($vbulletin->userinfo['field7']) {
     case 
'US Format':
        
$vbulletin->options['dateformat'] = 'm-d-y';
        break;
     case 
'Expanded US Format':
        
$vbulletin->options['dateformat'] = 'M jS, Y';
        break;
     case 
'European Format':
        
$vbulletin->options['dateformat'] = 'd-m-y';
        break;
     case 
'Expanded European Format':
        
$vbulletin->options['dateformat'] = 'jS M Y';
        break;
     default:
        
$vbulletin->options['dateformat'] = 'm-d-y';
    }

    
// ############ Time Format as Uservalue ################
    
switch ($vbulletin->userinfo['field8']) {
     case 
'12-Hour Time Format':
        
$vbulletin->options['timeformat'] = 'h:i A';
        break;
     case 
'24-Hour Time Format':
        
$vbulletin->options['timeformat'] = 'H:i';
        break;
     default:
        
$vbulletin->options['timeformat'] = 'h:i A';
    }

Note that you still need to create the two user fields specified in the .txt file and change the 'fieldx' fields (I'm using field7 and field8 on mine) on the PHP Code (above) corresponding to the two field id's you have created.

Hope this helps.
Reply With Quote
  #24  
Old 06-29-2010, 05:43 PM
MoMan MoMan is offline
 
Join Date: Oct 2005
Location: USA
Posts: 301
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Bhuwan View Post
Very nice...I've installed this...The only complaint I had was it wasn't doing the bottom portion of the time (All times are in GMT <> The time now is <>).

The reason is becuase that is calcualted BEFORE global_start is executed, so it takes the lang default...I solved this by changing the code a bit and moving it to fetch_userinfo....
I've done this as well. Here is the code you need to use if you want to place the hook at fetch_userinfo:

PHP Code:
// ############ Date Format as Uservalue ################
    
switch ($user['field14']) {
     case 
'US Format':
        
$vbulletin->options['dateformat'] = 'm-d-y';
        break;
     case 
'Expanded US Format':
        
$vbulletin->options['dateformat'] = 'M jS, Y';
        break;
     case 
'European Format':
        
$vbulletin->options['dateformat'] = 'd-m-y';
        break;
     case 
'Expanded European Format':
        
$vbulletin->options['dateformat'] = 'jS M Y';
        break;
     default:
        
$vbulletin->options['dateformat'] = 'm-d-y';
    }

    
// ############ Time Format as Uservalue ################
    
switch ($user['field15']) {
     case 
'12-Hour Time Format':
        
$vbulletin->options['timeformat'] = 'h:i A';
        break;
     case 
'24-Hour Time Format':
        
$vbulletin->options['timeformat'] = 'H:i';
        break;
     default:
        
$vbulletin->options['timeformat'] = 'h:i A';
    } 
Remember to change 14 and 15 to whatever your fields are.
Reply With Quote
  #25  
Old 07-16-2012, 12:48 AM
Amaury Amaury is offline
 
Join Date: Nov 2011
Location: Ellensburg, WA
Posts: 1,075
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is it possible to add more formats or allow users to put in their own custom format via the modification's options in the Admin CP, such as here?

Edit: This would be used on a forum running vBulletin 4.2.0, as seen by my signature, but KH99 said it should work.
Reply With Quote
  #26  
Old 07-16-2012, 01:32 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I guess I'll answer since the author hasn't been around in a while: You could add additional formats, since with this mod you have to manually create the custom profile fields anyway. You would need to add any additional formats to the custom profile field(s) and to the code in the plugin. (And in any case the plugin would probably need to be edited so that it's using the correct custom field numbers).

To allow a user to enter a custom setting you could create another profile field (or two, for date and time) that are text fields, then have each dropdown have an option for using the custom format. Then the plugin would have to check for the dropdown field being "Custom", and if so use the content of the text field as the format, like:

Code:
case 'Custom Date Format':
        $vbulletin->options['dateformat'] = $vbulletin->userinfo['fieldX'];
        break;
Reply With Quote
  #27  
Old 09-02-2012, 09:22 PM
Snowhog's Avatar
Snowhog Snowhog is offline
 
Join Date: Oct 2011
Location: Andover, MN
Posts: 423
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is a very old MOD, and has never been modified since being posted. Never the less, in vBulletin Version 4.2.0 Patch Level 2 (currently), this 'feature' is lacking and many of our European members have lamented at this lack of what they feel, and I concur with, is an essential user setting.

I followed the instructions and had it setup within just a few minutes.

Marked as Installed, voted as Excellent, and nominated for MOTM.
Reply With Quote
  #28  
Old 09-08-2012, 11:37 PM
Snowhog's Avatar
Snowhog Snowhog is offline
 
Join Date: Oct 2011
Location: Andover, MN
Posts: 423
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
I guess I'll answer since the author hasn't been around in a while: You could add additional formats, since with this mod you have to manually create the custom profile fields anyway. You would need to add any additional formats to the custom profile field(s) and to the code in the plugin. (And in any case the plugin would probably need to be edited so that it's using the correct custom field numbers).

To allow a user to enter a custom setting you could create another profile field (or two, for date and time) that are text fields, then have each dropdown have an option for using the custom format. Then the plugin would have to check for the dropdown field being "Custom", and if so use the content of the text field as the format, like:

Code:
case 'Custom Date Format':
        $vbulletin->options['dateformat'] = $vbulletin->userinfo['fieldX'];
        break;
This is how we modified the MOD:
Code:
if ($vbulletin->userinfo['userid']) {
	// ############ Date Format as Uservalue ################
	switch ($vbulletin->userinfo['field5']) {
	case 'US Format':
		$vbulletin->options['dateformat'] = 'm-d-y';
		break;
	case 'Expanded US Format':
		$vbulletin->options['dateformat'] = 'M jS, Y';
		break;
	case 'European Format':
		$vbulletin->options['dateformat'] = 'd-m-y';
		break;
	case 'Expanded European Format':
		$vbulletin->options['dateformat'] = 'jS M Y';
		break;
	// ### Begin MOD by SteveRiley 2012-09-02 ###
	case 'ISO Format':
		$vbulletin->options['dateformat'] = 'Y-m-d';
		break;
	case 'Counting Format':
		$vbulletin->options['dateformat'] = 'o:W:N/z';
		break;
	// ### End MOD by SteveRiley 2012-09-02 ###
	default:
		$vbulletin->options['dateformat'] = 'm-d-y';
	}

	// ############ Time Format as Uservalue ################
	switch ($vbulletin->userinfo['field6']) {
	case '12-Hour Time Format':
		$vbulletin->options['timeformat'] = 'h:i A';
		break;
	case '24-Hour Time Format':
		$vbulletin->options['timeformat'] = 'H:i';
		break;
	// ### Begin MOD by SteveRiley 2012-09-02 ###
	case 'Swatch Internet Format':
		$vbulletin->options['timeformat'] = 'B';
		break;
	case 'Unix Epoch Format':
		$vbulletin->options['timeformat'] = 'U';
		break;
	// ### End MOD by SteveRiley 2012-09-02 ###
	default:
		$vbulletin->options['timeformat'] = 'h:i A';
	}
}
Reply With Quote
  #29  
Old 05-06-2013, 01:51 PM
fpgeeks fpgeeks is offline
 
Join Date: Feb 2010
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Could someone please explain in simple, step by step instructions how to get this to work in 4.2.0?
Reply With Quote
  #30  
Old 10-15-2013, 03:25 PM
fwulfers fwulfers is offline
 
Join Date: Aug 2010
Location: NW Michigan (USA)
Posts: 137
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I used the original mod instructions and the user comments in this thread to write up complete instructions for vB4: https://vborg.vbsupport.ru/showthread.php?t=303431

Thanks to all who contributed in this thread, hope you don't mind.
Reply With Quote
Reply

Thread Tools

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 09:05 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05736 seconds
  • Memory Usage 2,320KB
  • Queries Executed 24 (?)
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
  • (3)bbcode_code
  • (2)bbcode_php
  • (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
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)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