Creating new events programatically
-
I’m creating a custom form for visitors to submit events using Formidible Forms, then creating either an Event or Recurring Event draft post depending on their selections — I tried the EM front end submission form but I just think moany of the options are too confusing for visitors, and the form template is more work to edit than creating posts programmatically.
It all works, except that I can’t seem to set the start and end dates and times. I see them set correctly in the debug panel:
[event_start_time:protected] => 07:30
[event_end_time:protected] => 09:00
[event_start_date:protected] => 2019-01-26
[event_end_date:protected] => 2019-01-31
[event_start:protected] => 2019-01-26 07:30
[event_end:protected] => 2019-01-31 09:00But in the form, the start end end dates are blank and both times are set to 12:00.
If I set the fields in the form and submit, the values seem to be in the correct format, I don’t see a difference, but I must be missing something.
Actually I do see this later in the debug screen, maybe I need to set this also? I’m guessing that this needs an EM function call of some kind to set though:
[start:protected] => EM_DateTime Object
(
[timezone_name:protected] => America/Los_Angeles
[timezone_manual_offset:protected] =>
[valid] =>
[date] => 1970-01-01 00:00:00.000000
[timezone_type] => 3
[timezone] => America/Los_Angeles
)Thanks!
David
- The topic ‘Creating new events programatically’ is closed to new replies.