The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Format raw birthday.
Is there any way to format a birthday in European format?
European Format (e.g., 25-04-98): d-m-y Now it is in American format: [birthday] => 03-04-1976 [birthday_search] => 1976-03-04 I want to use it as {vb:raw birthday} in European format. Could it be possible? Thanks in advance. --------------- Added [DATE]1347110644[/DATE] at [TIME]1347110644[/TIME] --------------- I can't do a PHP conversi?n because I want to format $post['birthday']. |
#2
|
|||
|
|||
Where do you want to be able to use it? I don't think there's any way to change what's in the database (unless you want to modify some of the vbulletin code), but you might be able to add a field to a SELECT and format it using MySQL functions.
|
#3
|
|||
|
|||
Settings > Options > Date and Time Options
|
#4
|
|||
|
|||
Oh right - that's a good point (if the birthday is already being displayed and you want to change the format). I was thinking of displaying it somewhere where it isn't showing at all. But even if that were true, my idea would still need a plugin so I guess it's not much help.
|
#5
|
|||
|
|||
Quote:
March 04, 1976 it's shown by {vb:raw post.birthday} as: 03-04-1976. So, I think I'll do a plugin. So, I need to know something: Is there anything like $vbulletin->userinfo but for posts? Something like $vbulletin->post? --------------- Added [DATE]1347193081[/DATE] at [TIME]1347193081[/TIME] --------------- Yes, it is... $post[birthday] ... and I should do... something like... $arr_birthday = explode('-', $post[birthday]); $eur_birthday = $arr_birthday[1]."-".$arr_birthday[0]."-".$arr_birhday[2]; And I should register that variable in postbit. What do you think about it? |
#6
|
|||
|
|||
At least, it works. But I wish I could register it in $post instead of using my own variable. Could I do $post['eur_birthday'] = $eur_birthday, in order to do {vb:raw post.eur_birthday}?
|
#7
|
|||
|
|||
Yes, that's probably what I would do. You might want to add a check to make sure $post[birthday] is set, and also there is be a $post[showbirthday] value that has the user's privacy selection:
0 = Hide Age and Date of Birth 1 = Display Only Age 2 = Display Age and Full Date of Birth 3 = Display Only Day and Month of Birth |
#8
|
|||
|
|||
(Do you think it could be useful If I release it as a add-on?)
One last question: I've tried to display $post.userfield11, which is a string(19), but nothing is shown. Code:
Array ( ... [field11] => Bla bla bla ... } |
#9
|
|||
|
|||
Well, I don't know that it would be really popular, but there's probably at least a few people out there who would use it.
Quote:
|
#10
|
|||
|
|||
No, it is not:
Code:
<div>City: {vb:raw post.field11}</div> |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|