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


Discussion in 'XenForo Development Discussions' started by Valhalla, Nov 14, 2014.

  1. Valhalla

    Valhalla Well-Known Member

    I'm looking to display something in "thread_view" only if the thread has been responded to within the last year (last_post_date).

    <xen:if is="{$canQuickReply} && {xen:number '{xen:calc '{xen:helper utctime}'} - 31556926'} < {$thread.last_post_date}">
    The above template change does not seem to work: If the thread's last post time is greater than the time one year ago.

    Any help would be appreciated,
  2. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    I think it will be something like this:
    <xen:if is="{$canQuickReply} && ({xen:calc {xen:helper utctime} - 31556926} < {$thread.last_post_date})">
    I haven't tested it... so do experiments with quotes if this one does not work.
  3. Valhalla

    Valhalla Well-Known Member

    Thanks, Goodie.

    It turns out {xen:helper utctime} doesn't actually exist in the core, but as an add-on. I used {$serverTime} instead.

    This is what worked:

    <xen:if is="({xen:calc '{$serverTime} - 31556926'} > {$thread.last_post_date}) && !{$thread.sticky}">
        <xen:set var="{$canReply}">0</xen:set>
        <xen:set var="{$canQuickReply}">0</xen:set>

Share This Page