Viewing 15 replies - 1 through 15 (of 16 total)
  • A couple of people have already reported this issue before, and every time a new ticket related to this appears I get more confused. Technically speaking the code that I wrote should work since it uses the base functions provided by WordPress, I generally recommend to check the time zone in the WordPress general settings page but no one have said that this helps.

    I will just add a new option in the plugin that allows you to configure the timezone independently from the settings provided by WordPress. This is going to confuse some people because there will be now two settings for the same thing, I will add a text that explain the purpose of that option as better as I can.

    I will update this when I finish writing the code for that option.

    Thread Starter lisaleague

    (@lisaleague)

    Hi Yorman,

    My WordPress time zone is correct. But when I receive a Sucuri notification of a post update – it says 4AM, but it is sent and received at 8AM, the correct time for the scheduled post.

    I also see logged in users in the dashboard in the tab Logged in Users, which does not match the time in the tab All users. It is behind by 4 hours, consistent with the email notifications.

    I’m also checking with my host about the server time, but because the time stamp on the logins is not matching my time, I can only go by my time in Gmail to get the actual time of an event.

    Thread Starter lisaleague

    (@lisaleague)

    Yorman, as an additional piece of info, the server time is in UTC which is 4 hours ahead of EST. This is standard and cannot be changed.

    But my notifications time from Sucuri was at 4AM when the event happened at 8AM EST, so that’s 8 hours difference.

    So if you’re hooking into the WordPress time instead of the server time, this should work.

    Add a new option seems to be a workaround.
    Maybe some debugging would help more.

    @yorman The notification uses:

    'Time' => SucuriScan::current_datetime(),

    local_time() returns local time ??
    then current_datetime() calls datetime() on local time adding the GMT offset twice.

    ps1 I suggest you to use date_i18n(), see wp-includes/functions.php.
    ps2 “3600” is HOUR_IN_SECONDS in WP

    Yes, please revert that changeset / read what I wrote and not just the code lines:
    https://www.ads-software.com/support/topic/notification-e-mail-timezone
    My code example undoed your calculation with $gmt_offset. (But just for the E-Mail notification) & did not change the sign!
    So please omit the manual adding of 3600 seconds. Unix time is Unix time and should not be changed. Use date_i18n() for output accordingly as Viktor suggested. So no additional timezone setting just for Sucuri should be necessary, that would be more confusing than helpful I think.

    I removed the GMT addition here [1] and it seemed to work in my tests. regarding the new option that I promised to add, I decided that it was not a good idea after all, people may get more confused with two different options to configure the timezone than by the incorrect times. Lets test this new code and see how it goes.

    [1] https://plugins.trac.www.ads-software.com/changeset/1215017

    Thread Starter lisaleague

    (@lisaleague)

    It does not need time options if it reflects the site setting in WordPress, so I’ll give this a try and let your know, thanks!

    Please be advised that you added GMT offset twice:

    public static function current_datetime(){
    // this is already local time
            $local_time = self::local_time();
    
    // the second time in in datetime()
            return self::datetime( $local_time );
        }

    I suggest to add a second parameter to datetime() which defults to true and pass it on to the third parameter of date_i18n().

    @yorman

    In Lisa’s notification email the time comes from

    'Time' => SucuriScan::current_datetime()

    But it is now in UTC.

    @yorman Please consider the above.

    @yorman Please fix this by removing duplicated conversion. See above comments.

    I changed the code here 1277858.

    Thank you.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Where are Sucuri time zone settings?’ is closed to new replies.