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

XF 1.3 Marking threads as old

Discussion in 'XenForo Questions and Support' started by Razasharp, Feb 24, 2014.

  1. Razasharp

    Razasharp Well-Known Member

    Is there a date conditional that I can use to alert members a thread is old?

    In the docs theres:

    <xen:date time="$datetime" />

    But that actually gives me an error on saving the template.
     
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    Use a conditional combined with $servertime and xen:calc to determine if a threads date is old. I believe there is an old addon in the archive that describes it.
     
    Razasharp likes this.
  3. Razasharp

    Razasharp Well-Known Member

    Something like this?

    PHP:
    $date = new DateTime("2012-03-24 17:45:12");

    <
    xen:if is="{$thread.last_post_date} < {$date}">
    show notice
    </xen:if>
    Not sure where I'd set the date :/
     
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    Code:
    <xen:if is="$servertime - $post.post_date > 604800">
    Show Notice
    </xen:if>
    That should be something along the lines of what you need. ($post.post_date may be wrong).
     
    Razasharp likes this.
  5. Razasharp

    Razasharp Well-Known Member

    Is there anyway I can specify a date Jeremy? I want all of our imported threads to show the notice (sorry should have made that clear in the first post).
     
  6. HWS

    HWS Well-Known Member

    Razasharp likes this.
  7. Razasharp

    Razasharp Well-Known Member

  8. Jeremy

    Jeremy XenForo Moderator Staff Member

    All dates are stored as a unix time stamp so roughly if $thread.post_date < IMPORTDATE would be the conditional.
     
    Razasharp likes this.
  9. Razasharp

    Razasharp Well-Known Member

    Awesome, thanks :)
     

Share This Page