This is a Wordpress Plugin I wrote intentionally for my personal use, and, of course, also as an exercise. The need for such a thing was a direct follow-up to the effort to move my personal data away from Google, the first step for that was to abandon Google Calendar and Google Contacts and host these on my own Server using Baikal (and no, I won't argue here about why one would want to move away from the technically brillant, 'free' solutions for personal data management from Google - anyone interested in that may ask me directly... - or just ask Google about reasons for that 😊 ). After having this running smoothly, I felt it would be a good Idea to also feed my public Calendar automatically from there (yes, 'automatically' is the keyword here: manually exporting to an ICS File is not a problem, but also not an elegant solution). First step to achieve this was of course searching for a Wordpress Plugin that would be able to do this, but, what the heck: I could not find one ! Although there is a huge number of Calendar Plugins out there, which can directly use (or at least import) .ics Files, Google Calendars, Facebook Calendars and what not, the search on Wordpress Plugins for 'caldav calendar' simply revealed nothing usable. So, what to do now ? Basically, there would be these Options:
- Pick one of the existing Calendar Plugins and extend it to connect to a CalDav Server
- Write a Calendar Plugin from scratch that connects to a CalDav Server and also does all the rest I would like to have (Full Calendar, Sidebar Widget, Events List...)
- Write a Plugin that would create one of the common Calendar Format Files and use that with an existing Calendar Plugin.
After some thinking over the whole thing, I decided to go for Option #3, as this would result in higher flexibility, especially not tieing the new functionality to a specific Calendar Plugin.
In fact, with approach #3, anyone having a personal CalDav Calendar Resource available can then just use any of the numerous Calendar Plugins out there that are able to directly use .ics files, install this Plugin in Addition and then point the Calendar Plugin of choice to the .ics file generated automatically at the desired Time Schedule.
So what would be the steps to achieve the desired goal ?
- Create a comprehensive Plugin Skeleton, which would be easily extendible
- Setting up an easy to use Admin Page for the CalDav Server URL, Credentials etc.
- Schedule the Process of connecting to the Server and creating a Calendar Data File from there via WP Cron
- Implement the actual Action: creating the Calendar Data File
As for Steps #1 and #2, I found a well documented Tool at http://plugin.michael-simpson.com/ which is a big help, IMHO, so thanks a lot to Michael Simpson ! Step #3, then, would be possible to be realized according to the Wordpress Cron Documentation with the help of WP Crontrol for testing and debugging. The last Step then, #4, could be realized following the proposals on pingveno.net. (In fact, this last Step was actually the first thing I checked out and proved to be working for me, still without any Wordpress Plugin Stuff around).
And now, after some fiddling around and debugging, the Plugin is in a state that worksforme 😊 - no more, no less, but I also felt there might be someone out there who would also benefit from such a thing, so I decided to already make it publicly available - in a first step, on my persononal Website - anyone interested can download it from Github (see End of Article).
But be warned: USE AT YOUR OWN RISK !
(Should not be too risky, though, as there isn't anywhere a functionality which could compromise/delete any valuable data, especially calendars etc... - the risk is mainly, that it just might not work)
Currently, I'm trying to figure out what still has to be done to make this available to a bigger audience by publishing it in the Wordpress Plugin Directory, which is my intention - I'm pretty sure someone else can use it too... So, what is left to be done before publishing to WP Dir:
- be sure everthing works as expected
- Check for (more) possible missing/faulty Settings and warn User, if any of these found
- Check out the WP Plugin Developer Docs to ensure all requirements are met
- Check the WP Coding Style Standards and correct any (big) faults in the Plugin Code
- create some comprehensive Icon(s)/Logo(s) for the Plugin
- Prepare for Internationalisation and provide at least a german Translation
As soon as this is done, I will try to get the Plugin published on WP Plugins to reach a bigger audience, and, of course, write a Blog Post about that 😊 - stay tuned !
The Plugin has now been checked by the WP Staff, and, after some back-and forth (mainly due to using plain curl instead of the WP http API), accepted - check it out here .
Version 1.1.0 is out - a major Improvement: this can now handle more than one CalDav Calendar at once ! This feature has been asked for in the WP Support forum, but to be honest, I had thought about that already before 😊 . Additionally, the Development Version is now always available at GitGub - be sure to check the File readme.txt there if you want to try that !