lifterlms
lifterlms copied to clipboard
Events: client and server event's dates are not saved with the same timezone.
Reproduction Steps
- Set WP timezone to something different than php local time.
- Produce a server side event, like sign-in/sign-out -> check the db entry date: set in the wp timezone
- Now produce a client side event - e.g. start a video (with the advanced-videos add-on) - and persist it in the db (e.g. exit the page).
Expected Behavior
- Both client and server side dates should be saved using the same time zone.
Actual Behavior
- Client side events date is saved using php local time (php
date()
to which we pass a GMT timestamp) while server side events are saved using wp local time The difference can be quite important as the first is usually a server setting the users are not going to change.
At the moment this impacts on the idle sessions (that need to be closed) only - as far as I can see.
I think we should definitely avoid storing the date using php local time, we need to decide whether we want to store it in GMT (gmdate()
) or using local wp timezone.
Historically we save dates using wp timezone, but I'd rather prefer storing dates in GMT.
We should probably build a db update routine too to fix server side stored event dates...(?)
Error Messages / Logs
n/a
System and Environment Information
LifterLMS 4.19.0
WordPress 5.7.0
This issue has been recreated:
- [x] Locally
- [ ] On a staging site
- [x] On a production website
- [x] With only LifterLMS and a default theme
Browser, Device, and Operating System Information
n/a
Related User Information
HS-158540