- This topic has 3 replies, 2 voices, and was last updated 6 years, 4 months ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘How do I …’ is closed to new topics and replies.
Events Made Easy › Forums › How do I … › How do I create EME events programmatically?
Hi everyone!
I’m developping a small wordpress plugin to fetch Google Calendar events. These events are then translated into different languages and exported into various formats (room plans, newsletters etc.). The website currently uses EME to display events and so I am looking for a method to programmatically create EME events from the sync’d Google Calendar events.
From reading the sources I assume something like this should work:
//New events:
$event = eme_new_event();
//...modify event here
eme_db_insert_event($event);
//Existing events:
$event = eme_get_event($id);
//--modify event here
eme_db_update_event($event);
Is this a valid approach? Do I have to take care of any side effects? Are there any event properties that need special consideration (e.g. images)?
Thanks a lot for your support, it is greatly appreciated!
Best, Ole Trenner,
Halle, Germany
That should work. For ease of use: first get an existing event and do a print_r on it, so you can see what is in it. Also for google cal to sync, use an event attribute that stores the google cal event id, so you can compare later on (although it will be a heavy query, maybe do eme_get_events for a certain day and then compare those resulting events). To understand events and attributes/properties: create them, use them and print_r it 🙂
Btw, although not the best in the world, check the eme-sync-facebook-events plugin, that’ll help you (I do something similar there not with event attributes but using the event property called ‘event_external_ref’)
Great, thanks so much for the quick (and helpful!) reply. I’ll give it a try and see how far I will get.
Keep up the great work, all the best –
Ole Trenner