Need help installing Zap Calendar? Click here for a tutorial on installing Zap Calendar, or find out how to add additional functionality to your Zap Calendar site with the dozens of add-ons available for Zap Calendar.

Plugin Name: icalsync (icalsubscribe in version 3 and earlier)

Availability: Zap Calendar Pro

Purpose: Display and synchronize events retrieved from an external calendar subscription.  Event additions, updates or deletions made to the external calendar (Google Calendar, for example) will be synchronized with the Zap Calendar calendar.  The plugin supports multiple subscriptions at different refresh frequencies.  Using this plugin, Zap Calendar can aggregate calendars from multiple sources to display or to create a single subscription containing the subscribed calendars.

Configuration:

After the plugin has been installed and enabled, create a new category specifically for the subscription. Zap Calendar requires a single category for each calendar subscription.  This subscription category should not be used by users to enter events, so the category should be set to read only.  Otherwise, user entered events will be deleted when the subscription is synchronized.  From the plugin tab, enter your subscription URL and the frequency it should be updated (every hour, every 4 hours, etc.).  The subscription URL must begin with "http://".  For URL's beggining with "webcal://", use "http://" instead.  URLs beginning with "https://" are not supported.  Use "http://" instead if your icalendar feed supports it.  To test the subscription, select the "Admin Tools" button from the Zap Calendar main control panel, where you can refresh the subscription manually.

Once the category has been setup with the icalendar subscription, add it to one or more of your views so that it will be displayed.

To refresh the subscriptions automatically, a cron job needs to be configured on your web server. Cron jobs are a way to schedule programs at regular intervals.  The Linux command "wget" is used in the cron job to call a Zap Calendar URL for refreshing the subscription. There are a total of 6 cronjobs for each subscription frequency: 1 hour, 2 hours, 4, hours, 6 hours, 12 hours and 24 hours.  Below is a sample cron job that you can use for your site.  The amperand "&" needs to be entered twice because this character is special in Linux commands. Using it twice overrides the behavior and creates a single ampersand for the URL.  Make sure to change "yourdomain.com" with the name of your website domain.  Also note the -O option is an upper case letter "O", not a zero.

Zap Calendar provides a security feature to prevent attacks on the subscription refresh URL. From the Zap Calendar global settings, you can specify the IP addresses authorized to refresh the subscription by URL.  By default, "127.0.0.1" is enabled, which is the localhost.  If you want to allow any host to refresh the subscription, use the IP address "*.*.*.*". (Note: only ip4 addresses are currently supported). Note: Prior to version 3.0.17, the IP addresses authorized to update events via a cron job was configured in the plugin settings.  This is now set in the component global settings beginning with version 3.0.17. Both the component and iCal Subscribe plugin should be at version 3.0.17 or later.

ZContent will also provide the cron job service to Pro customers who can not run it on their own servers at no additional charge. Contact Z Content for more details.

Sample Cron (Zap Calendar 4 and higher)

# Zap Calendar cron jobs
10 */1 * * * wget -O /dev/null "http://yourdomain.com/index.php?option=com_zcalendar&view=plugin&name=icalsync&task=cron&tmpl=component&freq=1" >/dev/null
11 */2 * * * wget -O /dev/null "http://yourdomain.com/index.php?option=com_zcalendar&view=plugin&name=icalsync&task=cron&tmpl=component&freq=2" >/dev/null
12 */4 * * * wget -O /dev/null "http://yourdomain.com/index.php?option=com_zcalendar&view=plugin&name=icalsync&task=cron&tmpl=component&freq=4" >/dev/null
13 */6 * * * wget -O /dev/null "http://yourdomain.com/index.php?option=com_zcalendar&view=plugin&name=icalsync&task=cron&tmpl=component&freq=6" >/dev/null
14 */12 * * * wget -O /dev/null "http://yourdomain.com/index.php?option=com_zcalendar&view=plugin&name=icalsync&task=cron&tmpl=component&freq=12" >/dev/null
15 6 * * * wget -O /dev/null "http://yourdomain.com/index.php?option=com_zcalendar&view=plugin&name=icalsync&task=cron&tmpl=component&freq=24" >/dev/null

Sample Cron (Joomla 1.6 and higher)

# Zap Calendar cron jobs
10 */1 * * * wget -O /dev/null "http://yourdomain.com/index.php?option=com_zcalendar&plugin=icalsubscribe&task=cron&freq=1" >/dev/null
11 */2 * * * wget -O /dev/null "http://yourdomain.com/index.php?option=com_zcalendar&plugin=icalsubscribe&task=cron&freq=2" >/dev/null
12 */4 * * * wget -O /dev/null "http://yourdomain.com/index.php?option=com_zcalendar&plugin=icalsubscribe&task=cron&freq=4" >/dev/null
13 */6 * * * wget -O /dev/null "http://yourdomain.com/index.php?option=com_zcalendar&plugin=icalsubscribe&task=cron&freq=6" >/dev/null
14 */12 * * * wget -O /dev/null "http://yourdomain.com/index.php?option=com_zcalendar&plugin=icalsubscribe&task=cron&freq=12" >/dev/null
15 6 * * * wget -O /dev/null "http://yourdomain.com/index.php?option=com_zcalendar&plugin=icalsubscribe&task=cron&freq=24" >/dev/null

Sample Cron (Joomla 1.5)

# Zap Calendar cron jobs
10 */1 * * * wget -O /dev/null "http://yourdomain.com/index2.php?option=com_zcalendar&plugin=icalsubscribe&task=cron&freq=1" >/dev/null
11 */2 * * * wget -O /dev/null "http://yourdomain.com/index2.php?option=com_zcalendar&plugin=icalsubscribe&task=cron&freq=2" >/dev/null
12 */4 * * * wget -O /dev/null "http://yourdomain.com/index2.php?option=com_zcalendar&plugin=icalsubscribe&task=cron&freq=4" >/dev/null
13 */6 * * * wget -O /dev/null "http://yourdomain.com/index2.php?option=com_zcalendar&plugin=icalsubscribe&task=cron&freq=6" >/dev/null
14 */12 * * * wget -O /dev/null "http://yourdomain.com/index2.php?option=com_zcalendar&plugin=icalsubscribe&task=cron&freq=12" >/dev/null
15 6 * * * wget -O /dev/null "http://yourdomain.com/index2.php?option=com_zcalendar&plugin=icalsubscribe&task=cron&freq=24" >/dev/null