vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   just need a code to get age from userid (https://vborg.vbsupport.ru/showthread.php?t=97612)

axi 10-05-2005 12:09 PM

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.

Reeve of shinra 10-05-2005 12:36 PM

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.

axi 10-05-2005 01:52 PM

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?

Andreas 10-05-2005 08:35 PM

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;
    }



axi 10-06-2005 01:33 PM

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?

Boofo 10-06-2005 02:57 PM

That code would go in the php file that you are using for your template. ;)

axi 10-06-2005 04:34 PM

ah ye, sort of get it now. but then what do i write in the template to pull out the age?

Boofo 10-06-2005 05:53 PM

$userinfo[age]

;)

axi 10-06-2005 09:17 PM

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?


All times are GMT. The time now is 12:48 AM.

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.02053 seconds
  • Memory Usage 1,742KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete