• Resolved dstonyh

    (@dstonyh)


    Hello,

    First, I very much like and enjoy this plugin, it works well.

    For my issue, however, I’ve been seeing incorrect modified dates, sometimes they were all the same time, just wrong, and I even had one that was modified in the year 4007. I enabled PHP Error Reporting, and saw this: http://prntscr.com/j4gofp

    Looking at the code, I fixed it with this (..includes/admin-screens.php:308):

    if (version_compare($wp_version, '4.6', '>=')) {
    	$m_time = get_the_modified_time('Y\/m\/d g\:i\:s a', $post_id);
    }
    else {
    	$m_time = get_the_modified_time('U', $post_id);
    }
    
    $dtime = DateTime::createFromFormat("Y\/m\/d g\:i\:s a", $m_time);
    $timestamp = $dtime->getTimestamp();
    $time_diff = time() - $timestamp;

    Result: http://prntscr.com/j4gsza

    For reference, I’m using WordPress 4.9.5, PHP version 7.2.3.

    Thanks,
    Tony.

    • This topic was modified 7 years, 11 months ago by dstonyh.
    • This topic was modified 7 years, 11 months ago by dstonyh.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author SilkyPress

    (@diana_burduja)

    Thank you for mentioning this.

    Apparently the warning shows up for PHP 7.2.+. We’ll fix this as soon as possible.

    Thread Starter dstonyh

    (@dstonyh)

    Thank you, appreciate you looking into it. I’ll mark this as resolved for now.

    Plugin Author SilkyPress

    (@diana_burduja)

    This is fixed in the 3.16 version.

    Thread Starter dstonyh

    (@dstonyh)

    Hello Diana,

    It does look much better now, however the modified time on my site is still incorrect, it’s offset by 7 hours, since I have my WordPress timezone set to -7 (Pacific Time). Not a huge deal, but if you look into this again, I would see about correcting the time for different time zones based on settings.

    Thanks,
    Tony.

    Plugin Author SilkyPress

    (@diana_burduja)

    Hi Tony,

    it looks like the get_the_modified_time function doesn’t take the timezone into account. The get_post_modified_time function is a better fit in this case.

    I’ve made a “silent release” with the modifications, i.e. published the changes without making a new version. If you want to test it, then you need to uninstall the plugin and install it again.

    Thank you for reporting this.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Incorrect modified dates’ is closed to new replies.