ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Long shot: is there a way to change the date on a comment, or to select only the comments entered after a specific date?

May 13, 2011 11:19am

Subscribe [3]
  • #1 / May 13, 2011 11:19am

    marianway

    24 posts

    Hello

    I am moving all the content over from an existing website (on a completely different platform) to my EE site (1.7.1)

    This includes some comments on some of the blog posts. We are entering these manually - but when displayed they all have today’s date.

    As far as I can see there’s no way to change the date of a comment - is that right?

    Could there be a way to write some code that says…

    If the comment was posted on/before May 14th 2011 (for example), then… Posted by {author}

    If the comment was posted after May 14th 2011, then… Posted by {author} on {comment_date format='%F %d, %Y'}

    Any ideas would be appreciated!

    Marian

  • #2 / May 14, 2011 4:37pm

    Greg Salt

    3988 posts

    Hi Marian,

    You can certainly change the date of a comment if you directly manipulate the database tables. However, for the second part of your question you should be able to do something like this in the comment entries tag:

    {if comment_date < '1305417660'}
    .... Posted by {author}
    {if:else}
    ... Posted by {author} on {comment_date format=’%F %d, %Y’}
    {/if}

    The first conditional checks the comment_date against 15th May 2011 at 00:01. The value shown is unixtime and I converted it here. Does that help?

    Cheers

    Greg

  • #3 / May 18, 2011 5:56pm

    marianway

    24 posts

    Hi Greg,

    Thank you very much. I have implemented the code and it does exactly what I wanted.

    (I’m a bit nervous about changing the database…)

    Thanks again,

    Marian

  • #4 / May 18, 2011 6:54pm

    Brandon Jones

    5500 posts

    Awesome, Marian. Glad Greg helped!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases