Architecture

LH Calendars is a CalDAV provider for LH DAV, which owns the protocol, login (application passwords), sync tokens and XML. LH Calendars registers two providers on lh_dav_collection_providers; both serve calendars/{user ID}/{collection}/ on the user’s home site only.

Home site

LH_Calendars::return_home_site_id(): the main site for super admins, otherwise the user’s primary site if they still belong to it, else their first site. Serving only there means someone who adds accounts for several sites does not see every calendar twice. LH DAV’s setup profile leaves out CalDAV on other sites, and the profile screen there links to the home site.

Personal calendars (LH_Calendars_Personal_Provider)

Organisation calendars (LH_Calendars_Organisations_Provider)

Profile and download

LH_Calendars_Profile adds “Your calendars” to the member’s own profile screen, and serves GET /wp-json/lh-calendars/v1/export/{calendar}: one .ics file of a personal calendar, timezones merged, for the signed-in user only.

iCalendar is read and written with sabre/vobject, installed with Composer into vendor/.