=== WP Connect ===
Contributors: garryheath
Tags: rotary, dacdb, membership, events, calendar
Requires at least: 5.9
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 2.9.7
License: GPL-2.0+
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connects WordPress sites to DACdb / iMembersDB for live Rotary club and district data: events, members, leaders, calendar.

== Description ==

**Rotary WP Connect** bridges your WordPress site and your DACdb or iMembersDB Rotary membership database. Place a single shortcode on any page and the plugin automatically fetches and renders live, up-to-date data — no manual copying, no stale rosters.

**Key Features**

* **District Leadership page** — Governor hero card, executives, officers, assistant governors, profile page links, sort order control
* **Interactive FullCalendar** — month grid + list view, event popups with speaker/location/description, category colours, mobile-responsive, subscribe buttons (Google Calendar, Apple Calendar, .ics download)
* **Club and district events** — upcoming event lists for both club and district calendars
* **Stories** — news stories with photos, read-more expansion, and social sharing
* **Members directory** — paginated, with photos, classification, contact link
* **Club leaders and district leaders** — configurable grid layout
* **Speakers** — upcoming meeting speakers with bio card view
* **Newsletters and documents** — bulletin lists and document libraries from DACdb file storage
* **Committees** — accessible accordion with chair photo, member list, and description
* **Interactive club map** — OpenStreetMap with meeting info popups (no Google Maps API key required), with a one-click embed code so other websites can show the same live map
* **Map Embeds admin tab** — see every website that has embedded your map and block specific ones
* **Club directory** — searchable, sortable list of all clubs in the district
* **Birthday list**, **meeting info**, **sponsors**, **college of governors**, **district areas**, and more
* **iCal subscription feeds** — compatible with Google Calendar, Apple Calendar, and Outlook
* **Google Analytics integration** — GA4, GTM, and Universal Analytics support

**Shortcode Reference**

`[rotary_connect show="d_leadership"]` — District leadership page
`[rotary_connect show="calendar" view="page"]` — Full calendar
`[rotary_connect show="calendar" view="list" limit="5"]` — Upcoming events list
`[rotary_connect show="stories"]` — Club/district news stories
`[rotary_connect show="members"]` — Member directory
`[rotary_connect show="map"]` — Interactive club map
`[rotary_connect show="club_list"]` — Club directory

See Settings → Rotary WP Connect for the full list of shortcodes and configuration options.

**Requirements**

* A valid subscription with DACdb (IsMyRotaryClub.org) or iMembersDB
* Your Account/District number and Club number (available from your DACdb account)

== Installation ==

1. Upload the `rotary-wp-connect` folder to `/wp-content/plugins/`
2. Activate the plugin through the **Plugins** menu in WordPress
3. Go to **Settings → Rotary WP Connect**
4. Enter your Account/District number, Club number, and select your system (DACdb or iMembersDB)
5. Place shortcodes on your pages — see the Settings page for the complete reference

== Frequently Asked Questions ==

= Do I need a DACdb subscription? =

Yes. The plugin fetches data from DACdb's (or iMembersDB's) web API. A valid website subscription is required. Contact support@memberminderpro.com for subscription enquiries.

= Does the map require a Google Maps API key? =

No. The club map uses OpenStreetMap via Leaflet.js — no API key, no billing account, no quota limits.

= How do I show only specific event categories on the calendar? =

Use the `catid` shortcode attribute: `[rotary_connect show="calendar" view="page" catid="970,114,190"]`

= How often is data refreshed? =

Event data is cached for 1 hour by default (configurable in Settings → Calendar → Event Data Cache Duration). Leadership and committee data caches for 1 hour. Subscription status caches for 6 hours. Map coordinates cache for 30 days.

= Can I display leadership data for a specific rotary year? =

The plugin displays the current rotary year's leadership data as returned by DACdb. Historical year data is not currently supported.

== Screenshots ==

1. District Leadership page with Governor hero card and person grid
2. Full-page interactive calendar with event popup
3. Club map with meeting information popups
4. Plugin settings page — Calendar tab
5. Plugin settings page — Leadership tab with Profile Page URLs

== Changelog ==

= 2.9.7 =
* Fixed: Oversized images (and other wide embeds/tables) in calendar event popups. A flyer in an event's description or location with a fixed width/height could overflow the popup and force a horizontal scrollbar. Popup content is now constrained to the popup's width and images scale proportionally, on both desktop and mobile.

= 2.9.6 =
* Fixed: The calendar page view ([rotary_connect show="calendar"]) rendered blank on sites running the FAZ Cookie Manager plugin. FAZ wraps `CSSStyleSheet.insertRule` and defers some rules, which made the bundled FullCalendar throw `IndexSizeError` while injecting its styles - aborting the whole script so the calendar never initialised. FullCalendar's style injection now appends at the sheet's current length and tolerates a rejected rule. No settings changes and no need to disable or reconfigure FAZ.
* Changed: FullCalendar script now loads with a distinct cache-busting version so browsers and page caches pick up the fix.

= 2.9.5 =
* Reverted: the plugin slug/folder/main-file rename attempted in v3.0.0 (`wp-connect-dacdb`) has been reverted back to `rotary-wp-connect`. A slug change has no path to auto-update an already-installed plugin - WordPress treats it as a completely different plugin, and every one of ~31 live sites would have needed a manual plugin swap (deactivate old, install new, delete old) with no way to do it through the normal update mechanism. Reverting restores normal one-click/automatic updates for every site already running WP Connect, with no per-site action required. No shortcode, option key, or user-facing behavior changed by either the rename or this revert.

= 3.0.0 =
* Changed: Plugin slug/folder renamed from `rotary-wp-connect` to `wp-connect-dacdb` — **reverted in 2.9.5, see above.**

= 2.9.4 =
* Fixed: The map embed icon's click handler is now shipped inside the already-enqueued `rwc-map.js` file instead of an inline `<script>` block in the shortcode's HTML output. Some page builders (Kubio's Shortcode block, in particular) strip inline `<script>` tags from shortcode output for security while leaving other markup untouched, which silently broke the click handler on sites using them - the icon and modal HTML rendered fine, but clicking it did nothing.

= 2.9.3 =
* Added: Map embed. A small icon in the corner of the club map ([rotary_connect show="map"]) lets any visitor copy a ready-to-paste snippet that shows the same live club map on another website. The embedded copy shows only the map itself - the embed icon never appears on the copy.
* Added: New "Map Embeds" settings tab lists every website that has requested embedded map data (first seen, last seen, request count) and lets you block specific ones with a checkbox. Blocking is a courtesy control based on the requesting browser's Origin/Referer, not a hard security boundary.
* Added: Public, read-only `rwc_map_embed_data` AJAX feed serving the map's marker/tile/view data as JSON for the embed script. It reuses the exact same cached DACdb feed and geocoding as the shortcode, so an embed view never triggers an extra live API call - only a lightweight cached JSON response, rate-limited per IP.
* Fixed: `RWC_VERSION` constant was out of sync with the plugin header and readme Stable tag (reporting 2.9.0 instead of the actual 2.9.2) - now consistent everywhere.

= 2.9.2 =
* Hardened: remaining `NonceVerification.Recommended` warnings resolved across the iCal feed, events JSON feed, story-list shortcode, debug page, and the activation/deactivation notice-suppression check — all are read-only, non-state-changing GET reads and are now documented with scoped `phpcs:ignore` annotations explaining why a nonce doesn't apply.
* Fixed: `$_GET['action']` in `class-rwc-plugin.php`'s admin-notice suppression check was compared without sanitization; now passed through `sanitize_key( wp_unslash( ... ) )`.

= 2.9.1 =
* Hardened: escaping, sanitization, and translator-comment fixes across the admin settings screen, widget, and shortcode error paths (no functional change to front-end output).
* Fixed: mixed ordered/unordered sprintf placeholders in the story-sync drop-threshold alert message, which could misformat the alert text.
* Fixed: `date()` calls that depended on runtime timezone state replaced with `gmdate()` for consistent event/story date display regardless of server timezone configuration.
* Fixed: `strip_tags()` replaced with `wp_strip_all_tags()` in the story summary generator.
* Fixed: leadership profile URL/sort form fields now pass through `wp_unslash()` + `sanitize_text_field()` before their existing `esc_url_raw()`/`absint()` sanitization.
* Added: `languages/` directory to match the plugin header's Domain Path.

= 2.9.0 =
* Removed: the Google Drive Browser feature — the `[gdrive_embed]` / `[simple_gdrive_embed]` shortcodes, the Google Drive settings tab, the AJAX folder browser, and all related CSS/JS assets have been removed from WP Connect.
* This functionality is now available as its own standalone plugin. If your site has Google Drive embeds, install the replacement plugin from https://garryheath.com/gdriveembed/ to keep them working — it uses the same shortcodes, so existing page content does not need to change.
* The Google Drive settings tab now shows a notice with a download link instead of the old configuration fields. The two shortcode tags remain registered as a safety net: logged-in editors see the removal notice with the download link where an embed used to be; site visitors simply see nothing, instead of literal `[gdrive_embed]` bracket text.

= 2.8.13 — 2026-06-22 =
* Fixed: the [gdrive_embed] file preview modal's close/download button overlapping with Google's own "popout" button in the iframe chrome. Root cause: the Google Drive `/preview` endpoint renders its own toolbar (including an "open in new tab" arrow) inside the iframe; our `.sgde-modal-controls` bar sits `position:absolute; top:8px; right:8px` in the same corner, creating an overlap. Fixed by appending `?rm=minimal` to all preview iframe URLs (for both `/file/d/...` and `/document/d/...` Google Drive endpoints), which suppresses Google's chrome entirely.
* Added: "Open in Google Drive" button to the modal controls bar, styled identically to the existing download and close buttons (grey square, white SVG icon). This replaces the functionality of the iframe popout button that was removed via `rm=minimal`. Button order is now: Download | Open in Drive | Close.
* Changed: admin footer credit updated with expanded attribution text (developer name, authorized distributor statement, support contact information).

= 2.8.12 — 2026-06-20 =
* Added: "Event \"More Info\" Link" dropdown in Calendar Settings, controlling the link target used by the "More Info »" button in calendar event popups (both the FullCalendar month-grid view and the list view). Two options: "IsMyRotaryClub.org (no login required) - default" (insecurelink, `https://www.ismyrotaryclub.org/wp_api_1-2/R_Event.cfm?EventID=...`) and "DACdb.com (requires DACdb login)" (securelink, `https://www.dacdb.com/Calendar/Event.cfm?EventID=...`, the previous hardcoded behaviour). A description below the dropdown explains when to use each option.
* Changed: the small-print note under the "More Info »" link now reads "Link requires login to DACdb" when securelink is selected, or "Link to more event details" when insecurelink is selected (the new default) -- previously this text was hardcoded to always mention a DACdb login regardless of which link was actually shown.
* Changed: default More Info link target switched from DACdb.com (login required) to IsMyRotaryClub.org (no login required), making event details accessible to all site visitors out of the box. Existing sites that have not touched this setting will see the new default link on upgrade; select "DACdb.com" from the dropdown to restore the previous behaviour.

= 2.8.11 — 2026-06-20 =
* Changed: plugin renamed from "Rotary WP Connect" to "WP Connect" -- cosmetic rename only. Updated everywhere the name is displayed: plugin header (Plugin Name, Plugin URI, Author URI), settings page logo and title, admin menu entries, footer credit, widget title, and all user-facing error/status messages.
* Changed: settings page logo replaced with the new WP Connect logo (`assets/img/wp-connect-logo.png`); the old `rotary-wp-connect-logo.png` file has been removed from the plugin.
* Changed: documentation/support link updated from `https://garryheath.com/rotary-wp-connect/` to `https://garryheath.com/wp-connect/` throughout (Plugin URI, Author URI, settings page header link, footer credit link).
* Note: this is a cosmetic rename only. The shortcode tag `[rotary_connect]` continues to work exactly as before -- existing pages on any site need no changes. The internal `rwc_` function/class prefix, the `rwc_options` database key, the plugin folder/file slug (`rotary-wp-connect`), and the plugin update-checker endpoint are all unchanged, so the existing auto-update mechanism continues to work without interruption on any site already running this plugin.

= 2.8.10 — 2026-06-18 =
* Fixed: close icon on the [gdrive_embed] preview modal invisible (grey square with no visible X), even though the click-to-close action worked correctly. Root cause: the close control was a `<button>` element using `stroke="currentColor"` to inherit its icon color from CSS — the download control (an `<a>` element, rendering correctly) used the identical technique, which confirmed the issue was specific to `<button>` elements, not a shared CSS rule. Some theme or browser default `<button>` styling was overriding color/stroke resolution in a way that defeated `!important` on the `color` property for that element type specifically. Fixed by converting the close control from `<button>` to `<a href="#" role="button">` (matching the download control's element type, with `event.preventDefault()` added to the click handler) and switching both icons from stroke-based `currentColor` SVGs to filled-path SVGs with an explicit `fill="#ffffff"` HTML attribute, removing all dependency on CSS color inheritance.
* Fixed: a leftover CSS rule (`fill: none !important`) from the previous stroke-based icon design would have hidden the new filled icons entirely. Updated to a `fill: #ffffff !important` backstop on the `<path>` elements instead.

= 2.8.9 — 2026-06-18 =
* Fixed: download and close buttons on the [gdrive_embed] file preview modal rendering as theme-blue squares instead of the intended black. Root cause: `.sgde-modal-download` is an `<a>` tag, and the Kubio theme (and likely others) applies a global button-style background to anchor elements that won the CSS cascade over the plugin's plain class selector. Hardened the selectors with the `.sgde-modal-controls` ancestor plus `!important` on `background`, `border`, `box-shadow`, `color`, and `text-decoration` — the same pattern already used elsewhere in this plugin (e.g. `.rwc-member-contact`) to beat theme-level anchor styling.
* Changed: button color from black to a neutral grey (#5f6368), with white icons, matching the requested cleaner/more elegant look. Hover state uses a slightly darker grey (#4a4d51).
* Changed: download and close icons redrawn with a bolder stroke (3px, round line caps/joins) so they read clearly at 18px instead of looking thin/wiry. Download icon redrawn as a proper down-arrow-onto-tray shape; close icon redrawn as a bold X with rounded line ends.

= 2.8.8 — 2026-06-18 =
* Fixed: every numeric and checkbox setting on the Google Drive tab (Default Height, Show Title Bar, Show Drive Link, Allow Fullscreen, Cache Duration, Border Radius, Thumbnail Size) was missing from `sanitize()` entirely and silently blanked on every Save Changes -- the same root-cause bug class previously found and fixed for the map marker URL field. All seven fields added to the sanitize allowlist.
* Added: "Preview Window Top Margin (px)" setting on the Google Drive tab (default 100px). Previously the 100px offset was hardcoded in CSS; it's now a proper site-wide setting passed through as a CSS custom property (`--sgde-modal-margin-top`) on the embed wrapper, so different sites or different [gdrive_embed] placements under a fixed header of a different height can each be tuned correctly.
* Changed: file preview modal's download and close buttons are now black squares (4px corner radius) with white icons, identical 36x36px size for both. The close button's icon switched from a text "&times;" character to an SVG X (two crossed lines) matching the download icon's visual weight and stroke style exactly.

= 2.8.7 — 2026-06-18 =
* Added: 100px top margin on the [gdrive_embed] file preview modal so it no longer sits flush against the top of the viewport. Modal alignment switched from vertically-centered to a fixed top offset (`margin-top: 100px`) with scroll fallback on shorter screens; mobile full-screen view adjusted to account for the offset.
* Fixed: file preview modal close button appearing as an empty blue circle with no visible icon. Replaced the SVG X icon with a literal "x" character (1.5em, white, centered) rendered via the HTML entity `&times;`, which displays reliably in every browser without depending on SVG rendering.
* Added: download button to the left of the close button on the file preview modal. Clicking it downloads the currently-previewed file directly via Google Drive's public download endpoint (`drive.google.com/uc?export=download`) -- no API key required, works for any file the visitor already has view access to.
* Added: `leaders_only="1"` attribute to [rotary_connect show="members"] -- filters the member directory down to only members with a non-empty `<clubposition>` (officers/board), using the exact same card layout and display settings as the full directory. Add `top_position="..."` (default "President") to pin a specific position to the very top of the list; everyone else sorts alphabetically by position, then by name. Note: DACdb's XML feed always emits a closing `</clubposition>` tag even for members with no position -- this is parsed correctly by SimpleXML as an empty string and was already being filtered correctly; no special-case handling was required.

= 2.8.6 — 2026-06-18 =
* Added: Grid view for [gdrive_embed] / [simple_gdrive_embed] -- thumbnail tiles with the filename shown underneath each tile, suitable for photo galleries and visual document libraries. Use `view="grid"` on the shortcode (default remains `view="list"` for compact document-library rows). Thumbnails are generated by Google's public thumbnail endpoint and work for actual images as well as Docs, Sheets, Slides, and PDFs -- no API key required. If a thumbnail fails to load (permissions or a transient Google error), the tile automatically falls back to a type icon.
* Added: `thumb_size="200"` shortcode attribute to control tile width/height in Grid view (60-400px, default 160px).
* Added: "Default Display Style" (List/Grid) and "Thumbnail Size" settings in the Google Drive tab, so a site-wide default can be set without specifying `view=` on every shortcode. Shortcode attributes always override the global default.

= 2.8.5 — 2026-06-18 =
* Fixed: [gdrive_embed] curly-quote fix from 2.8.4 did not catch all cases on block-based / FSE themes (e.g. Kubio). Root cause: themes built on full-site editing render page content block-by-block via the `render_block` filter rather than assembling one string that flows through the classic `the_content` filter. A shortcode typed into a Paragraph block or Shortcode block can be processed by `do_shortcode()` before our `the_content` filter ever sees it. Added a `render_block` filter (priority 9) that catches every individual block's HTML and normalises curly quotes inside `[gdrive_embed]`/`[simple_gdrive_embed]` tags before any rendering pipeline runs `do_shortcode()`.
* Added: `content_save_pre` filter — curly quotes inside gdrive shortcode tags are now also corrected in the stored `post_content` the next time the post or page is saved, in addition to being fixed on every render. This is a permanent fix to the database content, not just a render-time patch.

= 2.8.5 — 2026-06-18 =
* Fixed: [gdrive_embed] and [simple_gdrive_embed] shortcodes producing no output under any circumstances, even with correctly-formatted straight quotes. Root cause: `includes/modules/gdrive.php` was never actually loaded by the plugin. The `require_once` statement that should have included it was added to the wrong file (`class-rwc-plugin.php`) in a previous update and never took effect, while all other plugin modules are loaded from `rotary-wp-connect.php`. This meant `add_shortcode('gdrive_embed', ...)` was never called, so WordPress had no registered handler for the tag at all and silently stripped it from the page -- identical symptoms to the curly-quote bug, but with a different and more fundamental cause. Moved the require statement to `rotary-wp-connect.php` alongside every other module.
* Note: the curly-quote normalisation filters added in 2.8.4 were also never running (same root cause -- the file containing them was never loaded). They are active now that the module loads correctly.

= 2.8.4 — 2026-06-18 =
* Fixed: [gdrive_embed] and [simple_gdrive_embed] shortcodes rendering as nothing when the attribute quotes were "smart" typographic quotes (“ ”) instead of straight quotes ("). WordPress's shortcode parser only recognises straight double quotes around attribute values -- when a shortcode is typed or pasted somewhere that auto-converts quotes (word processors, some page builders, certain editor paste behaviors), WordPress silently strips the tag with no error message. Added a `the_content` filter (priority 9, runs before `do_shortcode` at priority 11) that detects `[gdrive_embed ...]` / `[simple_gdrive_embed ...]` tags specifically and normalises curly quotes to straight quotes inside those tags only -- surrounding prose text and its normal typographic quotes are untouched. Also applied to `widget_text_content` and `widget_block_content` for sidebar/widget placements.
* Changed: Replaced the built-in Rotary gear map marker PNG with the updated icon design (blue location pin with gold gear/wheel).

= 2.8.3 — 2026-06-18 =
* Fixed: Custom Marker PNG URL field blanking on Save Changes. Root cause: `rwc_map_marker_custom` was registered as a settings field and displayed correctly but was never included in the `sanitize()` function, so it was silently dropped from `$clean` on every save. Added `esc_url_raw()` sanitization for this field.
* Added: Built-in Rotary gear map marker (`rotary-map-marker.png`) as a second marker option in Map Marker Style, between "Standard Leaflet pin" and "Custom PNG". Select "Rotary gear pin (built-in)" to use the bundled blue/gold Rotary location pin without configuring a custom URL.
* Added: Google Drive tab in plugin settings. Integrates the full functionality of Simple GDrive Embed v2.1.0 natively: embed any publicly-shared Google Drive folder as an interactive file browser with subfolder navigation, file preview modal, breadcrumb trail, and dark-mode support. Shortcodes `[gdrive_embed url="..."]` and `[simple_gdrive_embed url="..."]` both work. Settings: default height, title bar, Drive link, fullscreen, cache duration, border radius. No Google API key required. The original Simple GDrive Embed plugin can remain installed alongside without conflict.

= 2.8.2 — 2026-06-18 =
* Fixed: Globe/website icon not showing on iPhone and other mobile devices. Root cause: the previous version used a WordPress Dashicons font icon (`dashicons-admin-site-alt3`) which only loads in the WP Admin — it is not enqueued on the front-end. Replaced with a self-contained inline SVG globe icon that renders on every browser and device without any external font dependency.
* Fixed: Club List table header cells stacking text on mobile. Tightened header cell padding to `6px 3px` and set `white-space: nowrap` on `<th>` elements so short column labels stay on one line.
* Changed: Club List "Website" column header shortened to "Web" (both desktop and mobile label). The expanded detail row still shows the full label "Website:".
* Added: Club List expanded detail row now shows all five fields: Meeting Place, Meeting Address, Website (full URL as a clickable link), Club Phone (as a `tel:` link), Club Email (as a `mailto:` link). Phone and email were present in JS but not being populated from PHP — fixed by adding `clubphone` and `clubemail` XML fields to the `$details` array.
* Changed: Removed redundant "Data Cache Duration" field from Club List and Map Settings section. The Sync Schedule dropdown + Sync Now + Refresh Club Coordinates buttons already control map data refresh; the extra cache duration dropdown was duplicate and confusing.
* Added: Data Cache Duration control (1/2/4/6/12/24 hours + Refresh Cache Now button) to the Leadership section, which previously had no cache settings.
* Changed: Custom Marker PNG URL field now includes a "Choose from Media Library" button that opens the standard WP Media Picker. Selected image URL is auto-filled into the input and a thumbnail preview appears below the field. `wp_enqueue_media()` is called on the plugin settings page to enable this.

= 2.8.1 — 2026-06-18 =
* Fixed: Newsletter API endpoint corrected from `wp_newsletter.cfm` to `wp_newsletters.cfm` (plural) in newsletters module, documents module, and admin API preview URL.
* Fixed: Members and leaders without a DACdb photo now show `person_icon.png` (the uploaded person silhouette) instead of a broken image. The placeholder also renders correctly in Committees and other modules that display member photos.
* Added: Photo Shape setting (Circle / Square with rounded corners) in Member Display Settings, positioned just before the Photo Size setting. Shape is applied via a CSS custom property (`--rwc-member-photo-radius`) so it is theme-proof. The `person_icon.png` placeholder uses `object-fit: contain` with padding so the silhouette scales correctly inside either shape.
* Added: Data Cache Duration (1/2/4/6/12/24 hours) + Refresh Cache Now button for Speakers, Members, Newsletters, Leadership, and Club List/Map settings sections. Each section independently controls how long its DACdb feed is cached. The Refresh Cache Now button clears only that section's transients without affecting other sections.
* Changed: Club List website column now shows a globe icon (dashicon `admin-site-alt3`) instead of the raw URL text. Clicking opens the club website in a new tab.
* Added: Club List expanded detail row (click any row to expand) now shows: Meeting Place, full Meeting Address, full Website URL, Club Phone, and Club Email.
* Fixed: Club List column headings on screens narrower than 600px are automatically shortened: "Meeting Day" -> "Day", "Meeting Time" -> "Time", "Meeting City" -> "City". Table font size reduced to 15px and cell padding reduced (`8px 2px`) on mobile.
* Added: Map Marker settings (Club List and Map tab): choose between the standard Leaflet pin or a custom PNG (paste any image URL), and set the marker size in pixels (8-128 px, default 32 px). Size scales the standard pin proportionally, or sets the icon dimensions for a custom PNG.

= 2.8.0 — 2026-06-17 =
* Fixed: Plugin not checking for updates. Two root causes: (1) The update checker was gated behind a `wp_remote_head()` pre-flight probe that verified the endpoint was reachable before registering PUC. WordPress REST API routes commonly return 404 for HEAD requests even when the GET endpoint works correctly, so the probe always evaluated to 'no'. (2) The probe result was cached in a transient for 24 hours, meaning even if the endpoint became reachable, PUC stayed disabled for up to a day. Fix: removed the pre-flight probe entirely. PUC handles unreachable endpoints gracefully with its own error handling and retry schedule — no custom gate is needed. PUC is now registered unconditionally. The stale transient (`rwc_update_endpoint_ok`) is deleted on plugin load so existing installs that cached 'no' start checking immediately after upgrading.

= 2.7.9 — 2026-06-17 =
* Fixed: [rotary_connect show="speakers"] showing no results. Root cause: the module was written for the `wp_event.cfm` XML structure (root `<event>` children, nested `<speaker>` object with sub-fields `<speakername>`, `<speakertopic>` etc). The correct endpoint `wp_speakers.cfm` returns a completely different structure: root `<speakerinfo>` children where `<speaker>` is a plain text string (the speaker name), `<topic>` is the topic, and `<description>` is the bio/detail HTML. The entire parsing block, table view renderer, and card view renderer have been rewritten to match the actual API response. Location field now displayed in card view.

= 2.7.8 — 2026-06-17 =
* Fixed: Settings page header still showed "Need help? Visit lzmsweb.com" -- updated to garryheath.com/rotary-wp-connect. Admin footer credit also updated.
* Fixed: "Sync Club Coordinates Now" button (button 1 in the Club List and Map Settings tab) did nothing when clicked -- it had no JavaScript handler at all. Added a complete JS handler bound to the correct element ID (`#rwc-map-sync-now`), wired to the same `rwc_refresh_map_coords` AJAX action as button 2. The "Last sync: Never" label now live-updates to the actual sync timestamp without a page reload.
* Fixed: "Last sync: Never" never updating after either sync button was pressed -- `rwc_map_coords_last_run` was read in the admin UI but never written by the AJAX handler. The timestamp is now saved via `update_option()` after every successful sync, and returned in the AJAX response so the label updates immediately.
* Fixed: Speakers shortcode calling `wp_event.cfm` instead of `wp_speakers.cfm`. The correct DACdb endpoint for speaker data is `wp_speakers.cfm?AccountID=5320&ClubID=0&Mo=6`; the event feed does not contain speaker records. Updated `modules/speakers.php` accordingly.
* Added: "Show API Result Links" checkbox in Plugin Settings. When enabled, each settings section header shows one or more small "API Results" buttons that open the raw DACdb API response for that section in a new browser tab. Useful for diagnosing data issues. Sections covered: Plugin Settings (subscription check), Club Events, District Events, Newsletters, Speakers, Members, Club List / Map, Leadership.

= 2.7.7 — 2026-06-17 =
* Changed: Plugin update source changed from a static JSON file on lzmsweb.com to the garryheath.com update API (`https://garryheath.com/wp-json/ghpdm/v1/update/rotary-wp-connect`). Client sites will now check this endpoint once per day and receive WordPress admin update notifications when a new version is published.
* Added: "Club List - Rows per Page" setting in the Club List and Map Settings tab. Controls the default number of rows shown per page in the `[rotary_connect show="club_list"]` DataTable (options: 10, 25, 50, 100, or All). The shortcode `pagelength=` attribute continues to override this setting on individual pages.

= 2.7.6 — 2026-06-17 =
* Fixed: PHP Parse error "unexpected identifier, expecting )" caused by Unicode typographic characters embedded in PHP single-quoted string literals across 24 files. Root cause: AI-generated code substituted curly apostrophes (U+2018/U+2019), curly double-quotes (U+201C/U+201D), en-dashes (U+2013), em-dashes (U+2014), and right-arrows (U+2192) for their ASCII equivalents. In PHP single-quoted strings, a curly apostrophe (') is valid UTF-8 but a standard apostrophe (') terminates the string, leaving the following word as a bare identifier -- triggering a parse error. All 28 PHP files audited and cleaned; 24 required changes (total: 1 curly apostrophe, 6 en-dashes, 217 em-dashes, 26 right-arrows replaced with ASCII equivalents).

= 2.7.5 — 2026-06-17 =
* Fixed: member directory displaying in a single unformatted column with no layout. Root cause: no CSS existed for the member grid, cards, or photos — the grid classes were generated but never styled. Added complete member card CSS: CSS Grid layout for 1/2/3/4 columns, responsive breakpoints (2-col at ≤767px, 1-col at ≤480px), circular cropped photo, card hover lift effect, styled name/position/classification/contact button.
* Added: Photo Size setting in Member Display Settings — configurable 40–400 px (default 100 px). Implemented via CSS custom property `--rwc-member-photo-width` on the wrapper div so all photos in a grid share the same size without per-element inline styles.
* Fixed: member info `<br>` separators hidden in CSS since the CSS Grid layout provides correct vertical spacing without them.

= 2.7.4 — 2026-06-17 =
* Fixed: member directory showing only the last member in the list regardless of how many members DACdb returns. Root cause: `iterator_to_array($xml->member)` — the default second argument is `true` (preserve keys), and PHP uses the XML element tag name as the key when iterating SimpleXML children. All 30 `<member>` nodes share the key `'member'`, so each overwrites the previous in the resulting array, leaving only the last one. Fixed by passing `false` as the second argument to use sequential integer keys `0, 1, 2, ...` so all members are preserved.

= 2.7.3 — 2026-06-17 =
* Fixed: Member Display Settings (columns per row, show photos, business name, etc.) not saving. Root cause: member integer fields were added to `$int_fields` via `array_merge()` AFTER the `foreach` loop that processes them had already run — the merged fields were never iterated, so no member setting ever made it into `$clean` and was never written to `wp_options`. Fixed by moving all member integer fields into the original `$int_fields` array definition before the loop.

= 2.7.2 — 2026-06-17 =
* Fixed: map tile layer changes in settings not reflected on front end even after installing v2.7.1. Root cause confirmed as page-cache serving stale HTML — `rwc_flush_page_caches()` now also calls `Cache_Enabler`, `Nginx Helper`, and `Comet Cache` APIs, and fires `wp_cache_flush()` for object caches. Additionally, JS now defers Leaflet initialisation until the container has non-zero pixel dimensions (prevents wrong-zoom tile requests being cached by the browser), and uses `IntersectionObserver` to init maps that scroll into view after page load.
* Fixed: map partially loaded on first hard page load, fully loaded after refresh. Root cause: Leaflet was initialising with `center:[0,0], zoom:2` before `fitBounds()` ran, causing tiles for the world-level zoom to be requested and cached by the browser. Fixed by guarding `initMap()` with an `offsetWidth/offsetHeight` check so Leaflet only starts when the container has real dimensions, plus retry passes at 200/500/1000/2000ms for containers that are briefly hidden during theme animations.

= 2.7.1 — 2026-06-17 =
* Fixed: Base Map Layer setting change had no visible effect on the rendered map. Root cause: tile URL config was baked into the cached HTML page. Fixed by moving all tile URL templates into `rwc-map.js` (versioned asset); only the chosen key (`osm`/`carto`/`esri`) is stored in HTML. Changing the tile setting now takes effect as soon as the page cache expires or is flushed.
* Fixed: Map shows partially on first hard page load, fully after refresh. Root cause: Leaflet `fitBounds()` computed zoom from container dimensions before the browser's layout/paint completed (e.g. during theme page-transition animations). Fixed by adding `invalidateSize()` calls at 100ms, 600ms, and 1500ms after init, plus a `ResizeObserver` that re-applies bounds whenever the container changes size (handles tabs, accordions, page builder reveals).
* Added: `rwc_flush_page_caches()` — called on plugin settings save. Purges page caches in WP Super Cache, W3 Total Cache, WP Rocket, LiteSpeed Cache, Autoptimize, SG Optimizer, Kinsta, and Breeze so tile and calendar setting changes are immediately visible.

= 2.7.0 — 2026-06-17 =
**Security fixes (see security advisory at https://garryheath.com/rotary-wp-connect/)**

* **SECURITY FIX — HIGH:** Stored XSS via Google Analytics tracking ID. Unanchored regex and `esc_js()` output allowed a privileged attacker to inject JavaScript executed for all site visitors. Fixed by: (a) fully-anchored allowlist validation at save time in `sanitize()`; (b) output via `wp_json_encode()` which uses JSON double-quote wrapping, immune to the single-quote escape-sequence bypass.
* **SECURITY FIX — MEDIUM:** Raw `$wpdb->query()` without `$wpdb->prepare()` in `ajax_flush_cal_cache`. Fixed by wrapping with `$wpdb->prepare()`. Deletion scope narrowed from all `rwc_*` transients to calendar-specific `rwc_cal_*` transients only, preserving subscription, DLC, and map caches.
* **SECURITY FIX — MEDIUM:** Unauthenticated public AJAX endpoints (`rwc_events_json`, `rwc_ical`) accepted unbounded user-controlled parameters enabling cache-key enumeration, DACdb API exhaustion, and potential IP blocklisting. Fixed by: stripping non-numeric characters from category IDs; clamping `months` to 1–24; limiting category IDs to 20 per request; adding a 30-requests-per-minute IP-based rate limit on the iCal endpoint.
* **SECURITY FIX — MEDIUM:** XXE (XML External Entity) vulnerability in all `simplexml_load_string()` calls. External entity loading not disabled, allowing a compromised or MITM'd DACdb response to trigger server-side file reads (PHP < 8.0). Fixed by introducing a central `rwc_safe_parse_xml()` helper that applies `LIBXML_NONET | LIBXML_DTDATTR`, uses `libxml_use_internal_errors()` instead of `@` suppression, and calls `libxml_disable_entity_loader(true)` on PHP 7.x. All eight direct `simplexml_load_string()` calls replaced.
* **CSS:** Leadership section headings (`rwc-leadership-section-heading`) — removed `font-size`, `font-weight`, and `color` declarations so the theme's heading style is inherited; updated top margin from `2em` to `1em`.
* **Meta:** Updated Plugin URI, Author, and Author URI to https://garryheath.com/rotary-wp-connect/

= 2.6.0 — 2026-06-16 =
* Added club name label at top of calendar event popups
* Added "More Info »" link to DACdb event detail page in calendar popups
* Added "Link requires login to DACdb" note under More Info button
* Removed "Show event category colour key" section from page-view calendar
* Added configurable event data cache duration (1/2/4/6/12/24 hours)
* Added "Refresh Cache Now" button to Calendar settings with last-refresh timestamp
* Calendar event cache now keyed per duration setting

= 2.5.3 — 2026-06-16 =
* Fixed: calendar event popups not visible on desktop/full-screen when page builder applies backdrop-filter or CSS transform to containers. Rewrote modal as fresh DOM injection (`document.createElement` + `document.body.appendChild`) immune to all CSS stacking context issues
* Fixed: removed stray `bootstrap.css` enqueue that caused 404 errors on every page load
* Calendar modal z-index raised to `2147483647` (integer max) with `!important` to beat sticky navbars and mega-menus

= 2.5.2 — 2026-06-15 =
* Fixed: modal z-index raised and display controlled via CSS class toggle + `style.setProperty('display','flex','important')` to survive theme `!important` overrides
* Added `body.rwc-modal-open` scroll lock

= 2.5.1 — 2026-06-15 =
* Fixed: calendar page-view event clicks not opening popup on desktop. Root cause: FullCalendar renders events as `<a href="">` elements — empty href causes browser page reload before JS handler fires. Fixed by removing `href` attribute in `eventDidMount`
* Mobile modal sizing: narrower box, smaller font sizes at ≤600px, iOS momentum scrolling

= 2.5.0 — 2026-06-14 =
* Calendar event popups now work correctly on mobile (modal teleported to `document.body` to escape page-builder stacking contexts)
* Calendar automatically switches to list view on screens narrower than 768px
* Subscribe section moved below the calendar; buttons replaced with SVG icons (Google Calendar, Apple Calendar, .ics)

= 2.4.2 — 2026-06-13 =
* iCal feeds: LOCATION field removed; location text, speaker, topic, and description combined into a single DESCRIPTION field in priority order
* New Calendar Page URL setting — appears as first line of every iCal event description as a link back to the site calendar

= 2.4.1 — 2026-06-13 =
* Fixed: iCal subscribe links (Google Calendar, Apple Calendar, .ics download) not working. Root cause: `/?rwc_ical=1` endpoint intercepted by page caches serving HTML instead of `.ics`. Moved to `admin-ajax.php` (never cached)

= 2.4.0 — 2026-06-12 =
* Sort order column added to Leadership Profile Page URLs admin table
* Profile URL data format updated: `userid → {url, sort}` (backwards compatible with legacy string format)
* All leadership Contact and Profile Page buttons now use full inline CSS for guaranteed consistent sizing across all themes
* Calendar popup: embedded HTML links in event descriptions now preserved (previously stripped to plain text)
* Calendar popup: "More Info »" button added linking to DACdb event detail page
* Calendar popup: "More Info »" link also added to list-view PHP modal

= 2.3.2 — 2026-06-11 =
* Fixed: `&apos;` displaying literally in calendar event titles and popup modals. Fixed at data source in `rwc_calendar_get_events()` via `html_entity_decode()` — applies to all display paths (list view, page view, iCal)
* Fixed: page-view calendar showing no events. Root cause: `/?rwc_events_json=1` endpoint intercepted by page caches. Moved events feed to `admin-ajax.php` (`rwc_events_json` action)
* Fixed: leadership Profile Page buttons larger than Contact buttons — all buttons now use complete inline CSS
* Fixed: Governor Profile Page link appearing in theme link colour — inline `color:#fff` applied

= 2.3.0 — 2026-06-10 =
* Fixed: iCal endpoint global `$options` scope error causing empty feeds
* Added WP-proxied events JSON endpoint for FullCalendar (replaces direct `R_GetEvents.cfm` call)
* Fixed: event titles with apostrophes showing `&apos;` in calendar popups
* Fixed: some calendar events opening to ismyrotaryclub.org instead of popup modal (removed `window.open` fallback for events with `url` property)
* Club name now shown below event title on calendar grid and in popup header
* "Club List and Map Settings" section heading renamed (was "Club Map Settings")

= 2.2.1 — 2026-06-09 =
* Fixed: Profile Page URLs field not appearing in Leadership settings (admin callback made live API call causing timeout; now reads from transient cache only)
* Fixed: "Reload People from DACdb" button not responding (inline script only output when cache was populated)
* Fixed: card centering — switched leadership grid from CSS Grid to Flexbox with `justify-content: center` so all rows center regardless of item count

= 2.2.0 — 2026-06-08 =
* Added Contact Form Source setting (General tab): choose between IsMyRotaryClub.org and DACdb.com emailer URLs
* All leadership Contact and Profile Page button colors applied as inline styles (theme-proof)
* Governor hero photo size configurable (default 250px)
* Phone number display removed from leadership page
* Popup contact modal: close bar redesigned to eliminate white space gap
* Profile Page URL map: admins assign profile URLs per DACdb userid; mapping survives role changes
* Popup contact modal: ismyrotary source gets taller frame (600px)
* Calendar event colors: default background and text color configurable via color pickers in Calendar tab
* Calendar page-view popup: formatted HTML output matching list-view (was raw text)

= 2.1.0 — 2026-06-07 =
* Leadership photo shape: circle or square with rounded corners
* Leadership photo size: configurable in pixels (40–400px)
* Leadership hero name color: color picker, applied as inline style
* Leadership contact link color: configurable, applied as inline style
* Leadership contact mode: new-tab link or in-page popup iframe modal
* Admin color picker: native `<input type="color">` + hex text field, synced via JS
* District Clubs tab (formerly Club Map): renamed; shows `club_list` shortcode hint

= 2.0.0 — 2026-06-06 =
* New Leadership tab in Settings
* New `[rotary_connect show="d_leadership"]` shortcode: Governor hero card, auto-grouped sections, profile page buttons, sort order control
* Leadership page CSS: responsive grid, Rotary blue/gold branding, hover animations
* Popup contact modal for leadership Contact buttons

= 1.9.0 — 2026-06-05 =
* Newsletters module: folder grouping, sort order, file type icons
* Documents module: shared XML feed with newsletters, filtered by type
* Speakers module: table and card view, category filter
* Committees module: accordion, single committee, and committee-leaders modes
* All three modules use `rwc_fetch_xml_cached()` and `esc_html()/esc_url()` throughout

== Upgrade Notice ==

= 2.7.0 =
**Security update — strongly recommended.** Fixes a High severity Stored XSS vulnerability (Google Analytics tracking ID) plus three Medium issues (raw SQL query, unauthenticated endpoint abuse, XXE). Upgrade from 2.6.0 or earlier immediately.
