2

One of the organisations I work with runs perhaps 70 events or more over the course of a year. Many of these are invitation only, so while we use Civi to handle these events most of them are set as active, but not public, so they don't appear in our main iCal feed, which we use to promote public-facing events.

I'm looking at using the Private iCal extension which gives me the ability to publish feed URLs for events that are not public and filtered by type, which is great. But what I ideally want to do is include in the iCal entry the content of a customer field that I've created for Events.

Any idea how I might go about this?

2
  • What kind of custom data? iCal feeds really just want a small amount of information and then link to the actual event. Feb 10, 2022 at 10:38
  • 1
    I agree that brevity is key. I want to include a Zoom URL that isn't published on the event information page, but is in the iCal feed.
    – Graham
    Feb 10, 2022 at 13:41

2 Answers 2

2

This is an old thread, but we had the same need for passing custom fields for CiviCRM events into a 3rd party calendar app, and figuring it out took a bit of sweat equity so hopefully this will help someone in the future.

You can add the following (or similar) to the /CRM/Core/Calendar/ICal.tpl file (ideally save it off into your template folder so it doesn't get overriden with CiviCRM upgrade):

{assign var="shortuid" value=$event.uid|substr:16}
{assign var="position" value="$shortuid|strpos:'_'}
{assign var="evid" value=$shortuid|truncate:$position:""}
X-MYCUSTOMFIELD:{crmAPI var='evt_info' entity='Event' action='get' return="custom_45" id=$evid}{foreach from=$evt_info.values item=evt}{foreach from=$evt.custom_45 item=ch name=chapter}
{if $smarty.foreach.chapter.first}{$ch}{else},{$ch}{/if}
{/foreach}{/foreach}

It's not super elegant, but I couldn't, for the life of me, figure out how to get the event ID ($event.id or $event_id or $eventid didn't work) so had to extract it from the $event.uid variable.

1

I've ended up using the Event ICS extension: https://lab.civicrm.org/extensions/eventics – which in its most recent form provides the ability to override the event location by entering whatever you want into the location field provided by the extension on a per-event basis. This lets me keep Zoom URLs off public-facing event information pages whilst still giving useful information to the people registering for the event.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.