XF 1.5 Secondary Custom Titles (using dates as criteria)

tekboi

Active member
I'm really hoping I can find enough information to achieve this on my own. But I don't know where to start looking.

What I want to do is have a 2nd custom user title right above the user's name in the post-bit in which I can set according to certain criteria.

For example:

If a user registered between Jan 1st 2014 and December 31st 2014, I would want the 2nd custom user title to say 'A'

If a user registered between Jan 1st 2015 and December 31st 2016, I would want 2nd custom user title to say 'B'


If there is already something out there that does something similar, please let me know. I have very little time to do any coding, but i'm willing to learn how to do it myself if it involves developement. It doesn't seem like it was take a ton of work to complete, but I don't see how to achieve this using user group promotions and template edits.
 
Maybe something like this will work
Code:
<xen:if is="{xen:time $user.register_date, 'Y'} == 2014">A</xen:if>
<xen:if is="{xen:time $user.register_date, 'Y'} >= 2015 AND {xen:time $user.register_date, 'Y'} <= 2016">B</xen:if>
 
Maybe something like this will work
Code:
<xen:if is="{xen:time $user.register_date, 'Y'} == 2014">A</xen:if>
<xen:if is="{xen:time $user.register_date, 'Y'} >= 2015 AND {xen:time $user.register_date, 'Y'} <= 2016">B</xen:if>
Can a parameter for $user.register_date also be YYYYMMDD? I guess I need to read up on some documentation for XF development.
 
You can use epoch timestamp to compare the values
https://www.epochconverter.com/
The equivalent of the previous example should be like this
Code:
<xen:if is="{$user.register_date} >= 1388534400 AND {$user.register_date} <= 1420070399">A</xen:if>
<xen:if is="{$user.register_date} >= 1420070400 AND {$user.register_date} <= 1483228799">B</xen:if>
 
Top Bottom