webwitnl
Forum Replies Created
-
Forget all that (possibly). I noticed at the WordPress installed plugins page that Burst was listed twice, one activated one deactivated. I renamed the old burst-statistics directory to burst-statistics-old earlier when I uploaded your first fix, and for some reason WordPress picked up on that renamed directory and picked up the javascript from there after I uploaded the second fix. I.e. the javascript came from burst-statistics-old/.
I deactivated the old plugin and activated the new one, and it picks up on the right javascript now. Hope that works, WordPress seems to be confused by me having just uploaded a new version directly instead of properly updating the plugin, and doesn’t know which is what. I still don’t entirely trust it, I added a console log to a script in the 2nd fix but I don’t see it.
I see in git there were some changes in TodayBlock.js from the version when this problem started.
Maybe it’s not gmt_offset, but this. In the old working version, it uses javascript Date(), in the new version it does this:
// get currentDate const currentDate = new Date(); // get current unix timestamp const currentUnix = Math.floor(currentDate.getTime() / 1000); // add burst_settings.gmt_offset x hour in seconds to currentUnix const currentUnixWithOffset = currentUnix + (burst_settings.gmt_offset * 3600);If gmt_offset is somehow working and has a value of 1, it seems an unnecessary hour is added, and it will be midnight one hour too soon. Because new Date() already gives the browsers timezone and local time, not UTC.
Anyway, I’ll leave you to it.
P.S. I just checked the code TodayBlock.js.
It uses gmt_offset. In my database gmt_offset is present but has no value, but timezone_string has (it’s set to Europe/Amsterdam). This is from the Worpress setting in admin.
Maybe the answer lies in there somewhere. I briefly searched for it and I’m just copying this from the Internet:
gmt_offsetis actually a bit of a strange setting; it can either be set (the manual timezone offsets in the timezone dropdown), or derived from the actual timezone. Likely, the settings endpoint should expose the raw value (either unset or the manual timezone offset), and the site info can expose the derived value (which will always have a value).The unfortunate situation is that there are indeed two different options:
- Newer
timezone_string, which saves PHP–style time zone. - Older
gmt_offset, which saves numeric float offset in hours.
But in newer environments
timezone_stringactually overridesgmt_offset, the value returned by the latter will be based on the former. However the opposite isn’t true —gmt_offsetmight be valid, whiletimezone_stringis empty.WordPress 5.3 had shipped
wp_timezone()function, that abstracts this and returns a validDateTimeZoneobject, regardless of underlying WP settings.Yeah I did that, with the earlier patch I saw the console logging was removed as it was in git, and yesterday that console logging was added as it was in git. (It was late so I didn’t look more carefully at the output.)
I have a feeling it’s just the date_start and date_end in the ajax call, and the backend is working correctly. So between 23:00 and 0:00 it doesn’t really start a new day but the date_start and date_end are a day ahead and the counter will stay at zero. But I didn’t check that, will check it tonight.
It’s just after 23:00 CET… I’m afraid it still reset to a new “Today” and 0 visitors.
Thanks, I installed the new version and will let you know how it works out.
Hi Hessel, unfortunately that did not fix it.
The mySQL query that selects the data from the database formatted the time based on the server time. For you this was presumably +01:00(CET).
Please note that the server and everything running on it is in UTC. Only WordPress is set to CET.
Can I just download the whole thing on github and replace the burst-statistics directory with that? Or otherwise let me know which exact files I need to copy.
This works great, thanks! P.S. I sent you guys an email as requested above, but I got a message from my mail server that it was not delivered in 24 hours because it was “greylisted”.
Actually that does not show the same number of product images but what I described.
Without SPAI it loads big image clicker-470-acme-whistles3.jpg, the default.
With SPAI it loads all the big images clicker-470-acme-whistles1.jpg, clicker-470-acme-whistles2.jpg, clicker-470-acme-whistles3.jpg, clicker-470-acme-whistles4.jpg, clicker-470-acme-whistles5.jpg, clicker-470-acme-whistles6.jpg, clicker-470-acme-whistles7.jpg, clicker-470-acme-whistles8a.jpg
- This reply was modified 3 years, 4 months ago by webwitnl.
https://www.wildewolf.nl/product/clicker-470-acme-whistles/
This runs all the latest WordPress/Woocommerce/Shortpixel AI versions. Gallery uses standard Storefront theme.
- This reply was modified 3 years, 4 months ago by webwitnl.
P.S. I tried two additional things: exclude the big images by class name, and exclude the whole page by url from using Shortpixel AI. This indeed changes the html of the images as expected. But it still loads those big images. Then I deactivate the Shortpixel plugin, and it does not load those big images.
So I was wondering, what does Shortpixel AI do also? Lazy load images. When I turn on “Native lazy-loading” the problem goes away.
Ah yeah I see it now. It’s now 15:51 CET and console gives:
dateRange:
Object { startDate: “2023-01-13”, endDate: “2023-01-19”, range: “last-7-days” }index.js:382:578682
gmt_offset: 1 index.js:382:578711
sql_timezone: SYSTEM index.js:382:578765
wp_time: 1674229894 index.js:382:578823
server_time: 1674226294 index.js:382:578871
sql_time 2023-01-20 14:51:34 index.js:382:578927
sql_time_utc: 2023-01-20 14:51:34 index.js:382:578975
device_time: 1674226295958 index.js:382:579033
device_timezone: Europe/Amsterdam
Are you referring to the browser console? It shows CET time, it’s just the time my OS is running in.
Thanks. Please note the server time is definitely in UTC. It’s now 14:13 CET. Server:
>date
Fri Jan 20 13:13:06 UTC 2023
- Newer