Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-07-2012, 09:25 PM
Seductor Seductor is offline
 
Join Date: May 2011
Posts: 128
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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'].
Reply With Quote
  #2  
Old 09-08-2012, 04:14 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 09-08-2012, 04:33 PM
nerbert nerbert is offline
 
Join Date: May 2008
Posts: 784
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Settings > Options > Date and Time Options
Reply With Quote
  #4  
Old 09-08-2012, 06:27 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 09-09-2012, 11:13 AM
Seductor Seductor is offline
 
Join Date: May 2011
Posts: 128
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
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.
I think I'll take this option, because the birthday is not being displayed and I want to change the output format.

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?
Reply With Quote
  #6  
Old 09-09-2012, 11:29 AM
Seductor Seductor is offline
 
Join Date: May 2011
Posts: 128
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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}?
Reply With Quote
  #7  
Old 09-09-2012, 11:33 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #8  
Old 09-09-2012, 11:41 AM
Seductor Seductor is offline
 
Join Date: May 2011
Posts: 128
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

(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
...
}
It is var_dumped okay, but it is not shown in postbit. Why could it be?
Reply With Quote
  #9  
Old 09-09-2012, 11:54 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Seductor View Post
(Do you think it could be useful If I release it as a add-on?)
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:
One last question: I've tried to display $post.userfield11, which is a string(19), but nothing is shown.
Maybe it's just that you've used 'userfield11' instead of just 'field11'?
Reply With Quote
  #10  
Old 09-09-2012, 12:03 PM
Seductor Seductor is offline
 
Join Date: May 2011
Posts: 128
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, it is not:
Code:
  <div>City: {vb:raw post.field11}</div>
[high]* Seductor seems puzzled.[/high]
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:03 PM.


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.04072 seconds
  • Memory Usage 2,252KB
  • Queries Executed 11 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)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