• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.1 Show Age in message_user_info

Chris D

XenForo developer
Staff member
#3
From the quick test I've just done, no.

{xen:number $birthday.age} is what displays the age (if the date and year of birth has been provided) in the profile.

That parameter then isn't passed to another template, so I would suspect that you'd need an add on for that to work.

Don't worry about posting in the add-on request forum just yet. I might be able to work this out.

EDIT: Ninjaaa!
 

James

Well-known member
#4
You can use XenForo_Model_UserProfile::calculateAge($year, $month, $day) to calculate their age, but that doesn't respect user privacy.

Instead, you should use XenForo_Model_UserProfile::getUserAge(array $user, $force = false)
(if force = true - ignore user privacy).

From there, you just pass the information to the $viewParams in XenForo_ControllerPublic_Thread::actionIndex();

From the quick test I've just done, no.

{xen:number $birthday.age} is what displays the age (if the date and year of birth has been provided) in the profile.

That parameter then isn't passed to another template, so I would suspect that you'd need an add on for that to work.

Don't worry about posting in the add-on request forum just yet. I might be able to work this out.

EDIT: Ninjaaa!
 

Chris D

XenForo developer
Staff member
#5
Thanks for this, so useful.

I had a go earlier but because I'm a beginner I got lost. I found getUserAge but was going about things in the wrong way.