Posts made by Tim Hunt

Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
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.
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Well, you have not said anything about what you want your custom form element type to do. It is much easier to give advice if we know the result you want.

It is possible to define a new field type in a plugin and use it. I did https://github.com/moodleou/moodle-tool_editrolesbycap/blob/main/capabilityformfield.php ages ago - but I have no idea if that is still the best approach.