• G’day Marcus,

    The templates for ical are now out of date since the reorg of the EM_Event object. I just fixed my ical code which was loosely based on one of those templates (I use an AJAX-style link to deliver an .ics file for event from a link on the event-single template); here’s the most pertinent bit relating to start and end dates:

    $gmtOffset = 60 * 60 * get_option('gmt_offset');
    $ics[] = 'DTSTART:' . date('Ymd\THis\Z', strtotime("{$EM_Event->event_start_date} {$EM_Event->event_start_time}") - $gmtOffset);
    $ics[] = 'DTEND:' . date('Ymd\THis\Z', strtotime("{$EM_Event->event_end_date} {$EM_Event->event_end_time}") - $gmtOffset);
    $ics[] = 'DTSTAMP:' . date('Ymd\THis\Z', strtotime($EM_Event->event_modified) - $gmtOffset);

    There are other bits where field names now need event_ prefix etc, but that date/time one just bit me in the bum twice today so I thought I’d share in case anyone else needs it.

    (I should probably write up a blog post about this sometime, but in the meantime you might want to drop that into your templates when you get around to updating them)

    https://www.ads-software.com/extend/plugins/events-manager/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    i think those are correct actually. There might be some places missing the prefix, but there’s something in place to also populate the old fields name for compatability.

    careful with ->end and ->start, because those are done on purpose, they’re timestamps for that start/end date/time.

    Thread Starter webaware

    (@webaware)

    Um, that is my point; your ical templates use ->start and ->end, but they’re empty, so you need to use ->event_start_date + ->event_start_time to get DTSTART, etc.

    Thread Starter webaware

    (@webaware)

    OK, I blogged my code for adding iCalendar links to event pages:

    https://snippets.webaware.com.au/snippets/give-your-events-manager-events-an-add-to-calendar-link/

    Thread Starter webaware

    (@webaware)

    And… I just “discovered” the #_EVENTICALLINK placeholder (duh!)

    And… I was mixed up. Somehow I had “fixed” my old code to have event_start and event_end, which of course don’t exist. Have replaced with start and end now.

    <slinks away with tail between legs> ??

    Thread Starter webaware

    (@webaware)

    But… your iCal template is using ->modified for the timestamp, which s now empty because that data (as a string) is in ->event_modified (so either you need to put the data back into ->modified or change the template)

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    start and end are definitely created each time (in EM_Event::load_postdata()):

    $this->start = strtotime($this->event_start_date." ".$this->event_start_time);
    $this->end = strtotime($this->event_end_date." ".$this->event_end_time);

    If it’s not available, then it’s a bug in some way (although for me this works as expected)

    You’re right about the ->modified one though, will fix.

    Thread Starter webaware

    (@webaware)

    Yeah, I don’t know where my brain was, probably insufficient level of bourbon which I’m addressing right now.

    cheers,
    Ross

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Events Manager] ical templates out-of-date’ is closed to new replies.