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

XF 1.5 display age in message_user_info

#1
I'm trying to display the age in message_user_info, just next to the gender. I added this:

Code:
        <xen:if is="@messageShowGender AND {$user.gender}">
           <dl class="pairsJustified xbGender">
             <dt><xen:if is="@xb_fa_messageUserInfo"><i class="fa fa-user fa-fw Tooltip" title="{xen:phrase gender}" data-offsetX="-6" data-offsetY="0"></i><xen:else />{xen:phrase gender}:</xen:if></dt>
             <dd itemprop="gender"><xen:if is="{$user.gender} == 'male'">{xen:phrase male}<xen:else />{xen:phrase female}</xen:if>
            
             <xen:if is="{$user.show_dob_year} AND @displayUserAge">
             , {xen:helper userage, $user} years old
             </xen:if>
             </dd>
           </dl>
         </xen:if>
But it is still displaying ", years old" even if there's no age to display (i removed birthday from registration page to make it optional)
 

Brogan

XenForo moderator
Staff member
#2
You could add $user.dob_year to the xen:if so the code will only run if that returns anything other than null.