Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-05-2005, 12:09 PM
axi axi is offline
 
Join Date: Jan 2005
Posts: 231
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default just need a code to get age from userid

hi

I have a custom template im working on for a page for my VB, and in there there is going to be profiles i am adding manually of some forum members.

i came across to the age part, and just cant add it manually or else il have to be changeing peoples age every month.

Is there a code i can just wack in there so it pulls a specific 'userid' age from the database or something?

Cheers.
Reply With Quote
  #2  
Old 10-05-2005, 12:36 PM
Reeve of shinra's Avatar
Reeve of shinra Reeve of shinra is offline
 
Join Date: Oct 2001
Location: NYC
Posts: 1,896
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

VB can display a persons age in thier postbit and I believe Kirby released a hack to show a users age in their profile. I would start there.
Reply With Quote
  #3  
Old 10-05-2005, 01:52 PM
axi axi is offline
 
Join Date: Jan 2005
Posts: 231
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Reeve of shinra
VB can display a persons age in thier postbit and I believe Kirby released a hack to show a users age in their profile. I would start there.

yes but i am asking for a code to dig up the age from a blank template. not from there postbit template or profile. i already tried looking up those templates and no success.

its pretty tricky. anyone can help?
Reply With Quote
  #4  
Old 10-05-2005, 08:35 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Userage in Profile was a Hack by boofo, but it is now a default feature
The Code is pretty simple:
PHP Code:
$bday explode('-'$userinfo['birthday']);

$year vbdate('Y'TIMENOWfalsefalse);
$month vbdate('n'TIMENOWfalsefalse);
$day vbdate('j'TIMENOWfalsefalse);
if (
$year $bday[2] AND $bday[2] != '0000')
{
    
$userinfo['age'] = $year $bday[2];
    if (
$month $bday[0] OR ($month == $bday[0] AND $day $bday[1]))
    {
        
$userinfo['age']--;
    }

    if (
$userinfo['age'] > 101)
    {
        
// Are there peoply who are 101 or older and use vBulletin? Doubt so ...
        
$show['age'] = false;
    }
    else
    {
        
$show['age'] = true;
    }

Reply With Quote
  #5  
Old 10-06-2005, 01:33 PM
axi axi is offline
 
Join Date: Jan 2005
Posts: 231
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok so how do i use that code? Should I just paste it into my template im working on, or do i need to specify the d.o.b or userid to look up to get results from?
Reply With Quote
  #6  
Old 10-06-2005, 02:57 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 code would go in the php file that you are using for your template.
Reply With Quote
  #7  
Old 10-06-2005, 04:34 PM
axi axi is offline
 
Join Date: Jan 2005
Posts: 231
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ah ye, sort of get it now. but then what do i write in the template to pull out the age?
Reply With Quote
  #8  
Old 10-06-2005, 05:53 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$userinfo[age]

Reply With Quote
  #9  
Old 10-06-2005, 09:17 PM
axi axi is offline
 
Join Date: Jan 2005
Posts: 231
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

But i am adding the profiles manually, its not database driven.. so wont i need to specify the userinfo manually too, like $userid=['23'] for instance?
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 07:45 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.04014 seconds
  • Memory Usage 2,252KB
  • Queries Executed 13 (?)
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
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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_postinfo_query
  • fetch_postinfo
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete