Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 09-01-2005, 11:24 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Age in profile

Is there a way to take the age from the postbit and have it show up in a member's profile?
Reply With Quote
  #2  
Old 09-01-2005, 11:46 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Mainly just a Copy&Paste Job

Hook: member_complete
PHP Code:
$curyear vbdate('Y'TIMENOWfalsefalse);
$curmonth vbdate('n'TIMENOWfalsefalse);
$curday vbdate('j'TIMENOWfalsefalse);

$date explode('-'$userinfo['birthday']);
if (
$curyear $date[2] AND $date[2] != '0000')
{
    
$userinfo['age'] = $curyear $date[2];
    if (
$curmonth $date[0] OR ($curmonth == $date[0] AND $curday $date[1]))
    {
        
$userinfo['age']--;
    }
    
    if (
$userinfo['age'] >= 101)
    {
        unset(
$userinfo['age']);
    }

Reply With Quote
  #3  
Old 09-01-2005, 11:59 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I tried do it this way but couldn't get it to show up. I was using the wrong variables in my code.

How do I get it to only show if you have it turned on for the postbit?
Reply With Quote
  #4  
Old 09-02-2005, 12:04 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wrap it in
PHP Code:
if ($vbulletin->options['postelements'] & 1)
{

Btw.: Above Code is untested, but should work.
Reply With Quote
  #5  
Old 09-02-2005, 12:09 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I just tried the member_complete code you posted and it doesn't show up in the profile either.

What has replaced this in 3.5?

Quote:
$gotage
Reply With Quote
  #6  
Old 09-02-2005, 12:25 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
I just tried the member_complete code you posted and it doesn't show up in the profile either.
You did place $userinfo[age] in Template MEMBERINFO, right?

$gotage doesn't appear in any vBulletin 3.0 Files?
Reply With Quote
  #7  
Old 09-02-2005, 01:28 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yessir, I did.

Here's the code from the class_postbit.php that I converted earlier (to what you almost have in youe code) and it didn't work either.

It looks like they are using $this->cache['age'] in place of $gotage now.

PHP Code:
   // Generate Age
  
if ($this->registry->options['postelements'] & POST_SHOW_AGE)
  {
   if (!
$this->cache['year'])
   {
    
$this->cache['year'] = vbdate('Y'TIMENOWfalsefalse);
    
$this->cache['month'] = vbdate('n'TIMENOWfalsefalse);
    
$this->cache['day'] = vbdate('j'TIMENOWfalsefalse);
   }
   if (empty(
$this->cache['age'][$this->post['userid']]))
   {
    
$date explode('-'$this->post['birthday']);
    if (
$this->cache['year'] > $date[2] AND $date[2] != '0000')
    {
     
$this->post['age'] = $this->cache['year'] - $date[2];
     if (
$this->cache['month'] < $date[0] OR ($this->cache['month'] == $date[0] AND $this->cache['day'] < $date[1]))
     {
      
$this->post['age']--;
     }
     if (
$this->post['age'] < 101)
     {
      
$this->cache['age'][$this->post['userid']] = $this->post['age'];
     }
     else
     {
      unset(
$this->post['age']);
     }
    }
   }
   else
   {
    
$this->post['age'] = $this->cache['age'][$this->post['userid']];
   }
  } 
Reply With Quote
  #8  
Old 09-02-2005, 01:42 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK ... time to check the Code (although I don't see why it should not work).
Reply With Quote
  #9  
Old 09-02-2005, 01:44 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You got me on this one, Kirby. I have been trying to get it to show in the profile for 2 days now.
Reply With Quote
  #10  
Old 09-02-2005, 01:52 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Naargh. Well, the Code is correct - but the Data it relies on isn't

$userinfo['birthday'] is already formatted at this point. But in member_start it isn't yet defined ...

So:

Hook: fetch_userinfo
PHP Code:
if (THIS_SCRIPT == 'member')
{
    
$user['realbirthday'] = $user['birthday'];

Hook: member_complete
PHP Code:
$curyear vbdate('Y'TIMENOWfalsefalse);
$curmonth vbdate('n'TIMENOWfalsefalse);
$curday vbdate('j'TIMENOWfalsefalse);

$date explode('-'$userinfo['realbirthday']);
if (
$curyear $date[2] AND $date[2] != '0000')
{
    
$userinfo['age'] = $curyear $date[2];
    if (
$curmonth $date[0] OR ($curmonth == $date[0] AND $curday $date[1]))
    {
        
$userinfo['age']--;
    }
    
    if (
$userinfo['age'] >= 101)
    {
        unset(
$userinfo['age']);
    }

10 minutes ... hmm. Too long
I am getting old - or tired.
Reply With Quote
Reply

Thread Tools
Display Modes

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 12:40 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.05715 seconds
  • Memory Usage 2,292KB
  • 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
  • (5)bbcode_php
  • (2)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete