Insert Event with PHP?
-
Hello. I’m a new webadmin for a site that’s been using Events Manager for a while. There’s a function in the custom theme, scheduled to run via WordPress’ cron, that imports events from an external application called EMS. It used to work by inserting rows into the em_events table, but after an events manager update, this isn’t working. The rows are inserted, but the events don’t appear in the interface.
I decided to go about things scientifically: I did a db backup right before and right after inserting a new event. I noticed that the changes to the database included a new row in em_events, a new row in posts, and a bunch of meta. I found it surprising that such a well used, well supported plugin writes information to the database in two different places. This seems like bad practice as far as what I’ve learned.
That aside, I added code to the script to insert a post and meta based on the imported event as well, they’re still not showing up in the interface. My email logs don’t indicate any errors.
I searched high and low, even on the official Events Manager website, for some sort of documentation on a function I can use to add events without re-creating code that already exists in the plugin. I couldn’t find anything, only functions for reading and filtering events. I was hoping someone could point me in the right direction, because the direct database inserts are improper, and they’re not working.
I could search through the EM code itself for such a function, but there are other tasks I need to complete that have greater importance. If anyone wants to take a look at my custom import code, I’ll gladly post it.
- The topic ‘Insert Event with PHP?’ is closed to new replies.