I think that, for performance, log events get buffered, and written to the database in chunks, which may explain weirdness if you triggere an event and immediately expect it to appear in a query.
Now I look again, it seems that the mobile app is happy just logging events when they hit the Moodle server, not when they were acutally done offline.
The only way I can think of to do what you want is a bit hacky. You need to use reflection to change the protected $event->data['timecreated'] between creating the event then triggering it.
Now I look again, it seems that the mobile app is happy just logging events when they hit the Moodle server, not when they were acutally done offline.
The only way I can think of to do what you want is a bit hacky. You need to use reflection to change the protected $event->data['timecreated'] between creating the event then triggering it.