I recently implemented the Edit Comments plugin on our site. One of my co-authors has asked me to implement a “Last edited at: XXXX” flag into edited comments. To do this, I need to be able to compare the ‘gmt_comment_date’ and ‘edit_date’ variables, and only display the flag line if they differ.
I was looking through this thread and find myself more confused that when I started, so I’m going to ask a new question rather than just appending to that thread, if that’s OK.
I was thinking I needed to write a bit of PHP for this, since one is a time_t and the other is a timestamp, but then I saw that other thread. I don’t understand how this is working. It looks to me that the example “solution” is doing a string comparison of the timestamps, but it’s doing it with textual month names. A string comparison would only work if it’s formatted as YYYYMMDDHHMMSS, wouldn’t it? Or is there something happening behind the scenes that’s converting these into time_t’s and comparing them arithmetically?
Also, since the gmt_comment_date is generated by the EE engine while edit_date is generated by the database at update time, there’s no guarantee that they are identical when a new comment is created, right? I’m thinking I need to do an integer comparison with a delta of 1 second to make sure that I only display my flag line if the comment is edited after its initial creation.
Looking forward to your thoughts on this.