vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Member's Age in Postbit & Getinfo Profile (automatically calculated from birthday) (https://vborg.vbsupport.ru/showthread.php?t=42050)

Erwin 08-07-2002 10:00 PM

Member's Age in Postbit & Getinfo Profile (automatically calculated from birthday)
 
Member's Age in Postbit & Getinfo Profile - by Dr. Erwin Loh
--------------------------------------------------------------------------

I requested this a while back. Since no one has released a hack like this, I worked out how to do it.

NOTE: This hack automatically shows the age of the person calculated from the birthday entered (it's not a separate input). If there is no birthdate or birthyear, the age doesn't show up automatically.

1) Postbit hack
-------------------

This hack basically places the member's age underneath his join date (or wherever you want) in the postbit, like this:


Registered: July 2000
Age: 18
Location: USA
Posts: 102


If the member has not entered his birth-year, then the age will NOT show up at all, like this:


Registered: July 2000
Location: USA
Posts: 102


This hack requires 1 file edit (functions.php), and 1 template edit (postbit).

2) Getinfo Profile hack
----------------------------

This adds the member's age in their profile.

I've added this to the installation text file. It's a matter of editing members.php and the getinfo template.

Installation text file here:

Erwin 08-08-2002 01:18 AM

Also, this doesn't add any additional queries to your forums. :)

Deska 08-08-2002 02:00 AM

Nice hack man, thank's...

Schorsch 08-08-2002 03:20 AM

Thank you Erwin!!

useful hack and very easy installation :)

cu
Schorsch

Erwin 08-08-2002 03:21 AM

I updated the code - there was a bug in the original installation file - please clear your cache and view the new code now. :)

Vile 08-08-2002 05:23 AM

Awesome hack. Installed it, works like a charm:)

Floris 08-08-2002 06:45 AM

Installed, works very nice. So easy to add. And I am happy it doesn't add another query.

Unknown553 08-08-2002 07:19 AM

Awesome hack man. *installed*

[D]Vincent 08-08-2002 07:34 AM

I wouldn't say it's awesome, I don't see what's so great about displaying the user's age, of course I'm admin of a FF site so that wouldn't interest me. Nice job though.

Vile 08-08-2002 08:22 AM

Quote:

Originally posted by [D]Vincent
I wouldn't say it's awesome, I don't see what's so great about displaying the user's age, of course I'm admin of a FF site so that wouldn't interest me. Nice job though.
Good point, but in that case, couldn't you say the same thing about a users post count, location, etc? :)

Erwin 08-08-2002 01:39 PM

Okay, I've updated the hack again, this time for the LAST time. I had to modify the hack because certain members had their ages off by 1 year.

Thanks to Boofo, who PMed me with a suggestion - I have incorporated his suggestion into my hack, and this has fixed up the age problem for certain members.

The hack should be working 100% now. :)

To upgrade, just download the text installation file, and replace the code in the functions.php with the new code.

Erwin 08-08-2002 02:00 PM

I had to fix 2 small bugs to do with birthdates with my update - The bug concerns members' birthdays which fall before 1970. I was wondering why there was a 54 year old on my site who insisted he was 53. :) According to Boofo, someone posted a fix on vb.com, and he PMed it to me. I've fixed this.

Birdie501 08-08-2002 02:04 PM

can you tell us which dates causes this errors?

Erwin 08-08-2002 02:09 PM

Quote:

Originally posted by Birdie501
can you tell us which dates causes this errors?
I suspected it was certain months, but it appeared to be fairly random - I tried to find a pattern with my members, but couldn't. Whatever date they had trouble with, when I applied it to my profile, it still worked for me with my old code, but not for them.

Anyway, the latest code in my hack works with no problems at all - whatever it is, the new code fixed it.

So just use the latest installation text file, and there should be no more problems.

Sketch 08-08-2002 06:21 PM

I can see the older folks on my board going crazy on me if I installed this. ;) It's a great idea though.

Aaron

Velocd 08-09-2002 12:11 AM

For an anime forum like mine, I'm all for it ;)
Heh, it'll be funny to see the attitude of some people change once knowing they are younger than others.

Good job Erwin *clicks install*


No more "what's your age" threads popping up every month. (and if they still do, god have mercy on the poor soul)

[D]Vincent 08-09-2002 01:25 AM

Vincent]
Quote:

Originally posted by Knightmare


Good point, but in that case, couldn't you say the same thing about a users post count, location, etc? :)

I don't display location either, I only display Posts, Online Stats, and Member ID, everything else is RPG related. Posts because members like to see how many posts they have and compete with their friends on the board sometimes. Online Stats because I belief people would like to see if someone is online or not. Member ID because I like to be able to see that I was the first person registered XD no not really I just like to see each member's ID.

ZiRu$ 08-09-2002 01:25 PM

dope......i shall install this

LordHelmut 08-10-2002 06:23 AM

Nice man, that was the first hack I have ever installed. I got it to work with very little effort. I have been studying the actual PHP that goes in the functions.php but I dont understand it. Im trying to learn but im so confused. Well, thanks for the hack, its awesome :)

ZiRu$ 08-14-2002 12:54 AM

Installed on 2.2.6 PERFECTLY.....thx

Mr. X 08-20-2002 05:17 AM

Great, just installed it.

NSeXcellent 08-23-2002 03:37 PM

Hmm.. i installed it, but nothing shows up. I've gone back over it 4 times to make sure its right. Still nothing.. any clue?

DrkFusion 08-23-2002 03:43 PM

Nice Work Erwin, thanks :)

Erwin 08-23-2002 03:52 PM

Quote:

Originally posted by NSeXcellent
Hmm.. i installed it, but nothing shows up. I've gone back over it 4 times to make sure its right. Still nothing.. any clue?
Did you put $age in your postbit? It works if you follow the instructions closely...

eXtremeTim 08-23-2002 11:49 PM

Not bad. Nice and simple. I will proble also install this one once i get my site back up and running. :)

NSeXcellent 08-24-2002 12:39 PM

Quote:

Originally posted by Erwin


Did you put $age in your postbit? It works if you follow the instructions closely...

Of course. Its only 2 steps. How could I forget that. :) I'll figure it out. I couldnt have screwed up TOO much :)

PsYc 08-24-2002 02:40 PM

cann someone help me with this code?

i have this in my member.php

to show the userage in members profile but when i view several profiles they are older than their birthday is

---------------------------

// Set userage !
if ($bbuserinfo[birthday] == '0000-00-00') {
$userage = "N/A";
} else {
if (date("Y")<$bday[0] or $bday[0]<1901 or $bday[0]=='0000') {
$userage = "N/A";
}
}

if ( ($userage!="N/A") ){
if (date("m")>=$bday[1] and date("d")>=$bday[2]) {
$userage=(date("Y")-$bday[0]);
eval("\$getinfo_userage = \"".gettemplate("getinfo_userage")."\";");
} else {
$userage=(date("Y")-$bday[0])+1;
eval("\$getinfo_userage = \"".gettemplate("getinfo_userage")."\";");
}

}


if ( ($userage!="N/A") ){
if (date("m")>=$bday[1] and date("d")<=$bday[2]) {
$userage=(date("Y")-$bday[0]);
eval("\$getinfo_userage = \"".gettemplate("getinfo_userage")."\";");
} else {
$userage=(date("Y")-$bday[0])+1;
eval("\$getinfo_userage = \"".gettemplate("getinfo_userage")."\";");
}

}

if ( ($userage!="N/A") ){
if (date("m")<=$bday[1] and date("d")<$bday[2]) {
$userage=(date("Y")-$bday[0])-1;
eval("\$getinfo_userage = \"".gettemplate("getinfo_userage")."\";");
} else {
$userage=(date("Y")-$bday[0]);
eval("\$getinfo_userage = \"".gettemplate("getinfo_userage")."\";");
}

}

--------------------------------------------

Birthday: 23.09.1982
Age: 20


^^ you see? he is older but its still August right? :)

anyone who knows how to fix this?

N9ne 08-24-2002 06:52 PM

I found something wrong!

A user set his birthdate to be in 1969 and it says he's 84 in the postbit :confused:

N9ne 08-24-2002 06:55 PM

ok Very strange I just checked his full profile in adminCP:

1918-06-12

That's what's set for his birthdate which means the 84 is RIGHT but in his PROFILE it says 1969, why does it say that :confused:

Erwin 08-25-2002 07:47 AM

Code removed from this post, and added to the TEXT installation file.

Erwin 08-25-2002 07:50 AM

Quote:

Originally posted by Tha Rock
ok Very strange I just checked his full profile in adminCP:

1918-06-12

That's what's set for his birthdate which means the 84 is RIGHT but in his PROFILE it says 1969, why does it say that :confused:

That's weird, and has nothing to do with my hack. :) Looks like somewhere along the line something went wrong. My hack just displays the member's age - it doesn't touch the database or make a query.

PsYc 08-25-2002 08:41 AM

thanks erwin, for the fix works now :)

Erwin 08-25-2002 09:19 AM

You're welcome. :)

Intex 08-27-2002 01:40 PM

Great hack, was looking for something like that. Do you know how I can show this on a members page that's outside of vB?

Erwin 08-27-2002 07:35 PM

Quote:

Originally posted by Intex
Great hack, was looking for something like that. Do you know how I can show this on a members page that's outside of vB?
Outside of vB? That's going to take a major rework of the code (remember, this code uses no queries). I don't know... anyone has any idea?

PHiXTiT 09-07-2002 11:11 AM

Great work! (INSTALLED)

Thanks:)

PHiXTiT 09-07-2002 03:38 PM

Just noticed that after installing this I had to move the admin/functions.php to a different area within as i lost the profile option in my postbit. No bigee, works great! Thanks:)

Erwin 09-07-2002 09:16 PM

Quote:

Originally posted by PHiXTiT
Just noticed that after installing this I had to move the admin/functions.php to a different area within as i lost the profile option in my postbit. No bigee, works great! Thanks:)
I have no idea what you just said there, but whatever it is, it's not because of this hack - this hack is placed in the place in functions.php that decides what to put in the postbit - the code of the hack itself is just a simple mathematical calculation that uses up no database query and does not interfere with any other lines of code in functions.php - unless you have another hack in functions.php that uses the same variables.

Bottom line - this hack works fine with no problems - the problem you had (whatever it is) is not because of this hack.

PHiXTiT 09-08-2002 01:19 AM

Well this was the first hack I installed on a clean 2.2.7 board and when modifying the admin/functions.php I lost the profile button on my postbit. I retried it a couple times and same thing.
So I bumped the area to be pasted a couple lines up and all is working great now.
Just so you know my postbit template is highly modified just for looks.
I was just pointing this out so that if others are having any problems in 2.2.7 to try what i did.
Great hack though, comes in handy. :)

Buddha 09-12-2002 03:20 PM

um... i know this is a simple hack, but i'm getting this error...

Quote:

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/fulldvdr/public_html/admin/functions.php on line 929

Fatal error: Call to undefined function: vbdate() in /home/fulldvdr/public_html/admin/sessions.php on line 403
line 929 is

Quote:

$buffer = str_replace(""", "\"", $buffer);
and line 203 in sessions is the last line in this quote

Quote:

// get formatted date/time
if ($bbuserinfo['lastvisit']) {
$bbuserinfo['lastvisitdate'] = vbdate($dateformat." ".$timeformat,$bbuserinfo['lastvisit']);
???


All times are GMT. The time now is 04:44 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.01315 seconds
  • Memory Usage 1,819KB
  • 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
  • (11)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete