{"type":"blog","id":"2011/2011-12-04-making-the-civievent-ical-feed-show-all-events","title":"Making the CiviEvent iCal feed show all events","url":"/blog/2011/2011-12-04-making-the-civievent-ical-feed-show-all-events","summary":"With Green Renters we find the iCal feed from CiviEvent (part of CiviCRM) invaluable to keep track of events and workshops we have coming up, generally we use the feed pulled into our personal iCal and Google calendars for internal organising, currently the feeds aren't available to anyone outside of staff.","date":"2011-12-04","tags":["CiviCRM","PHP"],"categories":["tech"],"body":"With [Green Renters](https://greenrenters.org) we find the iCal feed from CiviEvent (part of [CiviCRM](https://civicrm.org)) invaluable to keep track of events and workshops we have coming up, generally we use the feed pulled into our personal iCal and Google calendars for internal organising, currently the feeds aren't available to anyone outside of staff.\n\nWe also have a variety of views feeds on our website pulling CiviEvents into several places based on various parameters, basically we have several things that need to be confirmed before we want events going live into public pages onto the website for people to view and register. Also, sometimes we have private events, that are only for a select group of people and not for the public to register. However, we would still like then to show up in our calendars so we know they're coming up, we usually do this through marking events as 'not active' or 'not public'.\n\nCiviEvent's default way of handling iCal feeds is to only show events that are public and active and I've been scratching around trying to fathom how to override this so we could get the information we need and continue working as we do.\n\nIn the end, it was one of those stupidly simple solutions that takes advantage of [CiviCRMs php function override](https://wiki.civicrm.org/confluence/display/CRMDOC40/Directories) features, simply copy the '_sites/all/civicrm/CRM/Event/BAO/Event.php_' file into your custom php folder, in our case '_sites/drupal_site_folder/custom_php_folder/CRM/Event/BAO/Event.php_'.\n\nThen around line 754, depending on your CiviCRM version, find\n\n```text\n\n  <em>WHERE civicrm_event.is_active = 1</em>\n</div>\n\n\n  <em>AND civicrm_event.is_public = 1</em>\n</div>\n\n\n  <em>AND (is_template = 0 OR is_template IS NULL)</em>\n</div>\n\n\n</div>\n\ndelete the lines</div>\n\n\n  <pre style=\"border-style: initial; border-color: initial; \">\n\n</pre>\n  <div style=\"border-style: initial; border-color: initial; \">\n</div>\n  <div style=\"border-style: initial; border-color: initial; \">\n  <em>WHERE civicrm_event.is_active = 1</em>\n</div>\n  <div style=\"border-style: initial; border-color: initial; \">\n  <em>AND civicrm_event.is_public = 1</em>\n</div>\n  <div style=\"border-style: initial; border-color: initial; \">\n  <em>AND</em>\n</div>\n</div>\n\n\n</div>\n```\n\nSave the file. Make sure the Custom PHP path is set in _/civicrm/admin/setting/path?reset=1_ and all should be well and your iCal feed will be showing ALL events... Just make sure you don't share it with all and sundry...","links":[],"fields":{}}