XF 1.1 Show Age in message_user_info

FloV

Well-known member
Hey,

just a quick question: Is it possible to show the age of a user in message_user_info template?

Thanks in advance for your help! :)

Florian
 
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!
 
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!
 
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.
 
Top Bottom