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

{thread.last_post_date}

Valhalla

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

Code:
<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,
 

Mr. Goodie2Shoes

Well-known member
#2
I think it will be something like this:
Code:
<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.
 

Valhalla

Well-known member
#3
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:

Code:
<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>
</xen:if>