Display age instead of birthay?

Mod that adds a birthday field to the users profile, theire age are displayed beside the posts, and on there birthday they will have a greeting popup
Forum rules
The content in this forum is dated Dec. 21 2005 and can be used as Archive only. This Forum is LOCKED and READ ONLY !

Display age instead of birthay?

Postby donnie-d on Sun 26. Jun, 2005 02:29

How can profile_view_body.tpl be edited to display age instead of birthday?
donnie-d
Poster
Poster
 
Posts: 43
Joined: Tue 11. Nov, 2003 01:48

Postby Beeveer on Fri 01. Jul, 2005 23:32

Look here, move it an bit around, and you have the things you want ;)

http://mods.db9.dk/viewtopic.php?t=2571
Nee, ik geef geen antwoorden in het Nederlands, die horen thuis op www.phpbb.nl ;)
User avatar
Beeveer
brilliant supporter
 
Posts: 264
Joined: Tue 30. Nov, 2004 19:13
Location: Boskoop, South-Holland, the Netherlands

Postby easygo on Thu 14. Jul, 2005 18:52

Hi! If you want to display the age instead of birthday, just follow me. :wink:

Code: Select all
##############################################################
## MOD Title: User Age in Profile (Birthday mod required)
## MOD Author: easygo < webmaster@net4seven.de > http://www.net4seven.de
## MOD Description: This hack will display the Age instead of birthday in user profiles
##
## MOD Version: 1.07
##
## Installation Level: easy
## Installation Time: 5 minutes
## Files To Edit: 2
##
##         includes/usercp_viewprofile.php
##         templates/subSilver/profile_view_body.tpl
##
##############################################################
## Before adding this hack to your forum, you should back up all files related to this hack
##############################################################
## MOD History:
##
##   2005-07-14 - Initial Release
##   2005-07-18 - Bugfixing
##
##############################################################

#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php

#
#-----[ FIND ]------------------------------------------
#
// Start add - Birthday MOD
if ($profiledata['user_birthday']!=999999)
{
   $user_birthday = realdate($lang['DATE_FORMAT'], $profiledata['user_birthday']);
} else
{
   $user_birthday = $lang['No_birthday_specify'];
}
// End add - Birthday MOD

#
#-----[ REPLACE, WITH ]------------------------------------------
#
// Start add - Birthday MOD
if ($profiledata['user_birthday']!=999999)
{
//   $user_birthday = realdate($lang['DATE_FORMAT'], $profiledata['user_birthday']);
   $user_birthdate = realdate('md', $profiledata['user_birthday']);
   $this_year = create_date('Y', time(), $board_config['board_timezone']);
   $this_date = create_date('md', time(), $board_config['board_timezone']);
   $user_age = $this_year - realdate('Y', $profiledata['user_birthday']);
   if ( $this_date < $user_birthdate )
   {
      $user_age--;
   }
}
else
{
//   $user_birthday = $lang['No_birthday_specify'];
   $user_age = '';
}
// End add - Birthday MOD

#
#-----[ FIND ]------------------------------------------------
#
// Start add - Birthday MOD
   'BIRTHDAY' => $user_birthday,
// End add - Birthday MOD

#
#-----[ REPLACE, WITH ]------------------------------------------
#
// Start add - Birthday MOD
//   'BIRTHDAY' => $user_birthday,
   'L_AGE' => $lang['Age'],
   'USER_AGE' => $user_age,
// End add - Birthday MOD

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_view_body.tpl

#
#-----[ FIND ]------------------------------------------
#
      <tr>
        <td valign="top" align="right" nowrap="nowrap"><span class="gen">{L_BIRTHDAY}:</span></td>
        <td><b><span class="gen">{BIRTHDAY}</span></b></td>
      </tr>

#
#-----[ REPLACE, WITH ]------------------------------------------
#
      <tr>
        <td valign="top" align="right" nowrap="nowrap"><span class="gen">{L_AGE}:</span></td>
        <td><b><span class="gen">{USER_AGE}</span></b></td>
      </tr>

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM


EDIT: - mod install update -

greetz easy
Last edited by easygo on Tue 19. Jul, 2005 10:50, edited 1 time in total.
Here we go ^^
Image
easygo
Poster
Poster
 
Posts: 44
Joined: Tue 02. Nov, 2004 17:03

Postby BurninFingerTipz on Sun 17. Jul, 2005 20:40

This mod you posted makes it say I'm 20 in my profile when in the posts it says I'm 19... I'm actually 19, what could be wrong?

My birthday is Dec. 27, 1985... if you go by years that makes me 20, but by date that makes me 19, so whatever the mod is doing, it's thinking by years only.
BurninFingerTipz
Poster
Poster
 
Posts: 15
Joined: Wed 29. Jun, 2005 06:37

Postby easygo on Mon 18. Jul, 2005 00:36

Hi BurninFingerTipz,

please check your install once again, especially this part:

Code: Select all
#
#-----[ FIND ]------------------------------------------
#
   $user_birthdate = realdate('md', $profiledata['user_birthday']);

#
#-----[ AFTER, ADD ]------------------------------------------
#
   $user_age = $this_year - realdate('Y', $profiledata['user_birthday']);
   if ( $this_date < $user_birthdate )
   {
      $user_age--;
   }


Everything is in order? Sure?

Click the link for a good working demo.

http://www.net4seven.de/profile.php?mode=viewprofile&u=7

My birthday: 27th of September 1979

My age: 25 :wink: easy
Here we go ^^
Image
easygo
Poster
Poster
 
Posts: 44
Joined: Tue 02. Nov, 2004 17:03

Postby BurninFingerTipz on Mon 18. Jul, 2005 05:18

I have the stock Birthday mod installed, and all ur code installed.

Only thing I don't have installed is the birthday index_body.tpl display since I didn't want it.

Also, I have the mod modded to display age instead of birthday in posts.

[Edit] - This stock code for the birthday mod is
Code: Select all
   $user_birthday = realdate($lang['DATE_FORMAT'], $profiledata['user_birthday']);


You have
Code: Select all
   $user_birthdate = realdate('md', $profiledata['user_birthday']);
BurninFingerTipz
Poster
Poster
 
Posts: 15
Joined: Wed 29. Jun, 2005 06:37

Postby easygo on Mon 18. Jul, 2005 07:28

Well, that's the problem. My bad, sry

The following replacement is based on original code. Give it a try.

Code: Select all
#
#-----[ OPEN ]------------------------------------------------
#
includes/usercp_viewprofile.php

#
#-----[ FIND ]------------------------------------------------
#
// Start add - Birthday MOD
if ($profiledata['user_birthday']!=999999)
{
   $user_birthday = realdate($lang['DATE_FORMAT'], $profiledata['user_birthday']);
} else
{
   $user_birthday = $lang['No_birthday_specify'];
}
// End add - Birthday MOD

#
#-----[ REPLACE, WITH ]------------------------------------------
#
// Start add - Birthday MOD
if ($profiledata['user_birthday']!=999999)
{
//   $user_birthday = realdate($lang['DATE_FORMAT'], $profiledata['user_birthday']);
   $user_birthdate = realdate('md', $profiledata['user_birthday']);
   $this_year = create_date('Y', time(), $board_config['board_timezone']);
   $this_date = create_date('md', time(), $board_config['board_timezone']);
   $user_age = $this_year - realdate('Y', $profiledata['user_birthday']);
   if ( $this_date < $user_birthdate )
   {
      $user_age--;
   }
}
else
{
//   $user_birthday = $lang['No_birthday_specify'];
   $user_age = '';
}
// End add - Birthday MOD

#
#-----[ FIND ]------------------------------------------------
#
// Start add - Birthday MOD
   'BIRTHDAY' => $user_birthday,
// End add - Birthday MOD

#
#-----[ REPLACE, WITH ]------------------------------------------
#
// Start add - Birthday MOD
//   'BIRTHDAY' => $user_birthday,
   'L_AGE' => $lang['Age'],
   'USER_AGE' => $user_age,
// End add - Birthday MOD

#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM

greetz easy
Here we go ^^
Image
easygo
Poster
Poster
 
Posts: 44
Joined: Tue 02. Nov, 2004 17:03

Postby BurninFingerTipz on Mon 18. Jul, 2005 08:12

k workes great, I removed the "//" from the 3 sections of code you had voided because I wanted to keep the birthday date in the profile.

Thanks for all your quick responces and help.
BurninFingerTipz
Poster
Poster
 
Posts: 15
Joined: Wed 29. Jun, 2005 06:37

Next

Return to Birthday [2.0.10/EM]

Who is online

Users browsing this forum: No registered users and 1 guest

cron