XF 1.5 display age in message_user_info

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

        <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
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)


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