View Full Version : User Defined Date & Time Format Display
eoc_Jason
03 Oct 2005, 19:22
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
Keyser Söze
03 Oct 2005, 19:49
very neat hack my man, very nice, i got alot of users in the UK so they will appreciate this one
Sooner95
03 Oct 2005, 20:38
same here... thanks
I used this for 3.0.X, will use this for 3.5. Thanks.
MGM out
I hate to ask, but a screenshot would be nice on this one. ;)
eoc_Jason
04 Oct 2005, 19:51
Okay, posted a screenshot in the UserCP... Like I said before, all it does is change how the date / time is formatted on all the pages for the user.
csidlernet
05 Oct 2005, 04:57
Thanks lots!
/me install
JulianD
06 Dec 2005, 16:29
Would be nice to have an option for the user to select the Yesterday/Today mode or the detailed mode (1 minute ago, 1 hour ago, 1 day ago.. and so on).
Great hack!
eoc_Jason
07 Dec 2005, 01:24
You should be able to override that option too. Just folow the same methodology...
Would be nice to have an option for the user to select the Yesterday/Today mode or the detailed mode (1 minute ago, 1 hour ago, 1 day ago.. and so on).
Great hack!
JulianD
07 Dec 2005, 18:23
You should be able to override that option too. Just folow the same methodology...
Thanks Jason... Some users on my forums complained about the detailed mode so I wanted to give them the option to override this to another mode... I might take a look at your code later.
ShadowOne
10 Apr 2006, 17:11
Thank You EXACTLY What I Needed....
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....
zetetic
07 Jan 2007, 12:55
Nice hack, thanks!
FYI, I've just installed it on 3.6.4 without any issues.
molieman
10 Feb 2007, 22:09
however it will need to be modified to match up with the two "just created" user fields.
Hi, could you be a bit more specific on what I need to do, regarding modified to match....
Thanks in advance.
Maybe it requires more of an explanation from me.... I installed it in 3.6.4 and it ain't working. Looked pretty straight forward, just want to make sure I'm not missing anything.
Any guidance, will be appreciated :)
molieman
11 Feb 2007, 16:47
Answered my own question. For those asking the same question....
########## Modify The Plugin Code ##########
AdminCP -> Plugin Manager -> Plugin Manager
Custom Date & Time Formats -> Edit
In the PHP Code look for:
// ############ Date Format as Uservalue ################
switch ($vbulletin->userinfo['field12']) {
Change the 12 (next to field) to the field number matched to the User Profile Field (Field#) you created for "Date Format"
Now look for:
// ############ Time Format as Uservalue ################
switch ($vbulletin->userinfo['field13']) {
Change the 13 (next to field) to the field number matched to the User Profile Field (Field#) you created for "Time Format"
-----------------------------------------
Hope this helps:)
Caerydd
19 Feb 2008, 16:42
Looking for this for 3.6.8 and 3.7.x :( or a confirmation that it's working in 3.6.8
zetetic
29 Jun 2008, 22:46
It's working for me in 3.7.2 except for one thing, but I'm not sure if this is a new or old issue:
The time at the bottom of the forum index doesn't seem to be affected by this plugin.
imported_silkroad
30 Oct 2008, 21:45
In vB 3.7, I tried to install this as a product, but it will not install, giving a message to install as a plugin.
In the plugin manager, the following are required:
Product
Hook Location
This specifies the location within the vBulletin code of the hook that will fire this plugin function.
Title Enter a title that describes this plugin.
Execution Order
Use this field to enter the order in which code at the same hook will be executed.
Plugin PHP Code
Use this field to enter the PHP code that you would like to be run.
Could we get some instructions on the hook location in the vBulletin product?
Thanks!
visitangeles
03 May 2009, 08:46
In vB 3.7, I tried to install this as a product, but it will not install, giving a message to install as a plugin.
In the plugin manager, the following are required:
Could we get some instructions on the hook location in the vBulletin product?
Thanks!
has anyone figured out how to install this on 3.8x?
Dunhamzzz
25 May 2009, 18:23
I second the above post. Need a 3.8 version!
rsuplido
08 Sep 2009, 21:21
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:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
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.
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:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Remember to change 14 and 15 to whatever your fields are.
vBulletin® v3.6.12, Copyright ©2000-2012, Jelsoft Enterprises Ltd.