=== Groundswell for WordPress ===
Contributors: groundswell
Tags: petitions, activism, campaigns, signatures, gutenberg
Requires at least: 6.4
Tested up to: 6.6
Requires PHP: 8.1
Stable tag: 1.22.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Embed petitions, collect signatures, and create campaigns with Groundswell.

== Description ==

Groundswell for WordPress allows you to embed petitions from the Groundswell platform directly into your WordPress site. Visitors can sign petitions without leaving your site.

**Features:**

* **Gutenberg Blocks** - Modern block editor support for petition embedding and creation
* **Shortcodes** - Legacy support for classic editor and widgets
* **Sign on Site** - Visitors sign petitions without redirecting
* **Real-time Counts** - Signature counts update automatically
* **Customizable** - Light, dark, and auto themes

== Installation ==

1. Upload the `groundswell` folder to `/wp-content/plugins/`
2. Activate the plugin through the 'Plugins' menu
3. Go to Settings → Groundswell and enter your API key
4. Add the Groundswell blocks to your pages

== Frequently Asked Questions ==

= Where do I get an API key? =

Sign up at https://groundswell.io and create an API key in your account settings.

= Does this work with the classic editor? =

Yes! Use the `[groundswell type="large-card" slug="..."]` shortcode (type also accepts small-card, form, form-card, and list).

== Changelog ==

= 1.22.2 =
* Improved: the inline "thank you" message shown after signing now renders as a clear green confirmation banner with a check mark, instead of plain unstyled text.

= 1.22.1 =
* Fixed: the Text align control now aligns the petition title, description, and image — previously only the signature count and creator rows moved, so the heading and body text stayed left.
* Fixed: the Font weight control now actually changes the body text weight; it was being written to the wrapper but no element read it, so it had no visible effect.
* Changed: [gs-el type="form"] and the form inside [groundswell-container] now show only their own inline thank-you after signing, no longer also popping the share/donation modal. The petition card's form-card layout keeps the full post-sign flow.

= 1.22.0 =
* New: the donation shortcodes [groundswell-donate] and [groundswell-donate-button] now accept a class attribute, so the embed/button can be targeted from your own CSS — matching the class passthrough already on [groundswell], [groundswell-container], and [gs-el].
* Fixed: font-size set on a count element (e.g. [gs-el type="count" font-size="24px"]) now sizes the signature-count number itself, not just the wrapper. The number keeps its emphasised 1.25rem default and is unaffected by a site-wide font size.

= 1.21.0 =
* New: button alignment — left, center, right, or full width — for the sign/donate buttons, via the button-align attribute/token and the Appearance & Branding controls.
* New: image sizing — image-width and image-height for the petition image, and avatar-size for decision-maker and signer avatars, on shortcodes, blocks, and the Style Kit.
* New: per-element alignment — text-align, self-align, and margin (e.g. margin="0 auto") to position any element, plus container justify (main-axis distribution) and align (cross-axis) on top of the existing column/row/grid layout.
* New: recent-signature avatars (opt-in) — show each signer's avatar in the recent-signatures list/carousel via recent-avatar (shortcode/block) or avatar (container element). Off by default, so existing lists are unchanged.
* Improved: cleaner container element option names — count (recent-signatures/targets), variant (donation), height (spacer). The previous names keep working.
* New: optional labels on the count and progress elements — show-label="false" shows just the number or bar. And labels accept value placeholders {{count}}, {{goal}}, {{percent}} so you can write custom text, e.g. label="{{count}} people have signed" or label="{{percent}}% there".
* Improved: the How to Use guide documents every new option in detail.

= 1.20.0 =
* New: composable container, in both the block editor and as a shortcode. Add the "Groundswell Petition Container" block (pick a petition, then drag in "Groundswell Element" blocks), or wrap [gs-el] elements in [groundswell-container slug="…"]. Build your own petition layout from only the elements you want, in any order — title, description, image, creator, count, progress, form, sign-button, status, recent-signatures, targets (list or card), donation, social, and spacer. The petition loads once and is shared by every element; each element takes its own styling.
* New: inline social-share row element ([gs-el type="social"]) — a row of Facebook / X / LinkedIn / WhatsApp / Copy icons that shares the petition's canonical link, independent of the post-signature share popup. Set the link base under Settings → Groundswell → "Petition site URL".
* New: decision-maker "card" view ([gs-el type="targets" target-layout="card"]); the existing list view is unchanged.
* Fixed: preset names are now matched case-insensitively (e.g. preset="My Brand" resolves the saved "mybrand" preset) on the container, [gs-el], the [groundswell] shortcode and all blocks — previously a preset whose name had capitals or spaces was silently ignored.
* Note: existing blocks, shortcodes and layouts are unaffected — the container is entirely additive.

= 1.19.0 =
* New: recent-layout attribute (and a "Recent signatures layout" block control) lets the in-card recent signers show as a list or a carousel ticker — e.g. [groundswell type="form-card" slug="..." recent-signatures="5" recent-layout="carousel"].
* Improved: the How to Use guide documents the recent-layout attribute and the carousel option.

= 1.18.0 =
* New: text-shadow and border-style are now configurable design tokens — set them per element on blocks (Advanced Appearance), on the [groundswell] shortcode (text-shadow, border-style), and site-wide under Appearance & Branding.
* New: font-weight is now exposed in the Appearance & Branding and block Advanced Appearance controls (it was previously only settable via the shortcode attribute).
* New: a "Clear cache now" button under Settings → Groundswell → Display Settings purges all cached petition data on demand.
* Fixed: cache flushing now works on sites using an external object cache (Redis / Memcached). Invalidation uses a version namespace instead of a direct database delete, so a flush takes effect on every backend.
* Improved: the How to Use guide documents the new styling options and adds the previously missing Border color row.

= 1.16.1 =
* Changed: removed the standalone "Groundswell Help" item from the Settings menu. The "How to Use" guide is unchanged and still opens from the "Open the How to Use guide" link on the Groundswell settings page.

= 1.16.0 =
* New: dedicated "How to Use" help page (Settings → Groundswell Help, also linked from the settings page) with a full-width, professional layout — a table of contents plus detailed documentation and copyable examples for every block option, shortcode type, and attribute.
* Improved: the Appearance & Branding "Style Studio" now uses richer controls — colour pickers, a font-family picker, value+unit inputs, and sliders for line-height / opacity / carousel speed.
* Improved: the Groundswell settings screen uses a responsive two-column layout on wider screens.

= 1.15.0 =
* New: advanced styling API so you can blend Groundswell elements into your own site design. A site-wide "Style Kit", reusable named presets, and a Custom CSS box live under Settings → Appearance & Branding. Blocks gain an "Advanced Appearance" panel; the [groundswell] shortcode gains matching attributes (preset, class, radius, button-radius, button-style, border-width, border-color, font-family, font-size, heading-size, line-height, padding, gap, shadow, opacity, carousel-speed). Existing petitions are unaffected — every new option defaults to the current look.

= 1.14.0 =
* New: recent-signatures carousel. A horizontal, auto-scrolling ticker of recent signers, available as [groundswell type="signatures-carousel" slug="..." recent-signatures="10"] and as the "Recent signatures carousel" layout in the petition block. The existing vertical list is unchanged. The marquee pauses on hover/focus and falls back to a static scrollable row when the visitor prefers reduced motion.

= 1.13.1 =
* Changed: signature counts are no longer cached — every count shown (cards, progress bars, lists) reflects new signatures immediately on each page load, instead of after the cache TTL.
* Fixed: after signing, every on-page display of that petition's count now updates at once — the "N signatures" count, the "N of M goal" progress text, and the progress-bar fill — across all instances of the petition on the page (including list items).

= 1.13.0 =
* New: native Donorbox embedding. The post-signature donation popup embeds each petition's Donorbox campaign directly — the Donorbox WordPress plugin is no longer required. The campaign (set on the petition in Groundswell) accepts either a full URL (https://donorbox.org/your-campaign) or a bare slug (your-campaign).
* New: [groundswell-donate] shortcode to place a Donorbox donation form anywhere (page, post, or page builder). With no attributes it uses the current Petition Page's campaign; pass [groundswell-donate slug="your-campaign"] to target a specific one.
* New: [groundswell-donate-button] shortcode — shows a button that opens the donation form in a modal (same styling as the post-signature donation popup) instead of embedding it inline. Supports label, title, and subtitle attributes plus the same slug override.
* Changed: the donation popup is now non-configurable — the "Donation shortcode" setting (and the Donorbox-plugin install/activate prompts) have been removed. Donation forms come straight from the petition's Donorbox campaign.

= 1.12.0 =
* New: post-signature popup flow. After someone signs (modal or inline form), the plugin can fire a confetti burst, then show a Share popup (Facebook, X/Twitter, WhatsApp, LinkedIn and Copy Link) to help spread the petition, then an optional Donation popup.
* New: "Post-Signature Popups" settings panel (Settings → Groundswell) to toggle confetti, the share popup (with customizable title, subtitle and share message) and the donation popup (with customizable title, subtitle and a donation shortcode, e.g. [donate] from Donorbox).
* New: the settings page detects the Donorbox plugin and offers one-click Install / Activate links when the donation popup is enabled but Donorbox is missing. The "How to Use" section documents the whole flow.

= 1.11.2 =
* Fixed: the petition card's UI strings (the "Sign this petition" button, "Started by", "of … goal", "signatures", "Read more", the sign modal, etc.) now follow the petition's display language (es, fr, de, pt, it, zh) instead of staying in English.
* Changed: the petition card now credits the owning organization — "Started by [organization]" — falling back to the individual creator when the petition has no organization.

= 1.11.1 =
* Improved: decision-maker target images are now larger (80px) so the person is easier to recognize.

= 1.11.0 =
* New: decision-maker "targets" can be displayed on the Groundswell Petition block and the `[groundswell]` shortcode (`target="1–10"`, plus `target-avatar="true|false"` for images). Shows each target's name, title, organization, and X/Twitter link.
* New: standalone `type="signatures"` and `type="targets"` shortcodes, and matching "Recent signatures only" / "Decision makers only" block layouts, to show either element on its own without the petition card.
* Changed: `recent-signatures` is now a number (how many to show; `0`/`false` hides it); the separate `recent-count` attribute is removed. Recent signatures and targets render in the large-card, small-card, and form-card layouts.
* Improved: the Groundswell Petition block's sidebar options (Layout, Description, Theme, Colors, etc.) now appear as soon as the block is inserted, instead of only after a petition is embedded.
* Docs: the Settings "How to Use" subsections (Blocks, Shortcode, Petition Pages) are now collapsed by default.

= 1.10.0 =
* New: "Show Recent Signatures" option on the Groundswell Petition block and the `[groundswell]` shortcode (`recent-signatures="true"`, `recent-count="1–20"`, default 5). Lists the most recent signers (name + location) below the petition; anonymous signers show as "Anonymous". Works with the large-card, form-card, and form layouts.

= 1.9.1 =
* Docs: the Settings "How to Use" section now lists every shortcode attribute with its values and defaults, and its subsections (Blocks, Shortcode, Petition Pages) are collapsible.

= 1.9.0 =
* New: the `description` attribute now has three modes — `full`, `expandable` (clamped preview with a "Read more" / "Read less" toggle, the default), and `trimmed` (clamped preview, no toggle). Blocks expose the same choice via a "Description" selector (replacing the old on/off "Show Full Description" toggle).

= 1.8.0 =
* Changed: one shortcode now does everything — `[groundswell]` with `type="large-card|small-card|form|form-card|list"`. The separate `[groundswell_petition]` / `[groundswell_petitions]` shortcodes were removed (Petition Pages are migrated automatically).
* Improved: small-card image is a fixed 4:3 thumbnail anchored to the top (and stays in view while a long description scrolls) instead of stretching into a distorted strip on long petitions.
* Docs: rewrote the Settings "How to Use" shortcode reference with a layout list and an attribute table.

= 1.7.0 =
* New: unified `[groundswell]` shortcode with `type="large-card|small-card|form|form-card"` plus `description`, `show-signatures`, `show-progress`, `language`, `theme`, and color attributes.
* New: color customization on cards and lists — `text-color`, `button-color`, `accent-color`, `background-color` shortcode attributes and matching block Color panels (button text auto-contrasts).
* New: block "Layout" selector (large card / small card / card + inline form / form only) mirroring the shortcode `type`.
* Improved: small (list) card design — larger image that matches the card height, responsive stacking on mobile, and normalized heading sizes so a body `<h2>` no longer dominates the card.
* New: the Petitions admin list now shows each petition's slug with a one-click Copy button.

= 1.6.0 =
* Fixed: petition pages and embeds now display the selected language (including Chinese, Italian, Portuguese) by requesting the petition with `?locale=`, which translates both the title and description. Previously only en/es/fr/de were translated and the title/body fell back to the source language.
* New: render the signing form directly on the page instead of behind a "Sign this petition" button/modal.
* New: "Show Full Description" on both the petition card and the list (small cards) — when off, descriptions show a clamped preview with a "Read more" / "Read less" toggle; no card truncates without a way to expand.
* Changed: petition descriptions now render the full rich text from the API.
* Removed: the "Create New" button on the Petitions admin list (petitions are not created from the plugin). Petition Pages are unaffected.

= 1.5.4 =
* Docs: the language help text now lists all supported translation locales (en, es, fr, de, pt, it, zh). No functional change — the picker already offers whichever languages a petition has been translated into.

= 1.5.3 =
* Petition Pages now render through the active theme's own single template (via the_content) instead of a bespoke plugin template. The page inherits the theme's content width, margins, spacing, and typography, fixing the unstyled/plain look on block and classic themes.

= 1.5.2 =
* Settings page: the "How to Use" section now documents Petition Pages and explains when to use them versus a block or shortcode.

= 1.5.1 =
* Fix the admin Petitions list failing to load ("Failed to load petitions") — the proxy sent an unsupported sort value to the API; it now sends a valid sort and maps search to the API's query parameter and category to categoryId.
* Admin Petitions list now shows the real error message on failure and no longer shows the empty-state message at the same time as an error.

= 1.5.0 =
* New "Petition Pages" post type: create a WordPress page that displays a chosen Groundswell petition. Pick the petition (and language) from a dropdown in the editor — no slug or shortcode needed.
* Each petition page renders the live, signable petition on its own URL, and all pages are listed at /petitions/.

= 1.4.1 =
* Shortcode: [groundswell_petition] now accepts a "language" attribute (e.g. language="es") so petitions can be shown in a translated language outside the block editor (Elementor, Classic editor, widgets).
* Settings page: clearer "How to Use" section with copy-to-clipboard shortcode snippets, a full attribute reference, and an Elementor note.

= 1.4.0 =
* Petition Embed block: select a petition from a dropdown of your organization's petitions (fetched from Groundswell) instead of typing a slug by hand. The manual slug field remains available.
* Petition Embed block: choose the language to display the petition in. Only languages that have a translation are offered; the translated title and description are shown on the frontend.

= 1.3.2 =
* Petition list ("[groundswell_petitions]" / Petition List block) now opens the inline sign modal instead of redirecting away from your site
* Fix petition links pointing to the wrong domain (groundswell.io) — now use groundswell.petitions.io
* Refactor: the frontend sign assets are enqueued once from a shared helper, fixing duplicate localization when a page shows multiple petitions

= 1.3.1 =
* Fix petition title, description, image, signature count and goal not displaying — the API returns camelCase fields which are now normalized to the keys the templates expect
* Fix signature goal progress bar not rendering for the same reason
* Accept org-scoped API keys carrying the "gs_live_" prefix in the settings validator
* Post-sign signature count now reads both camelCase and snake_case response shapes

= 1.3.0 =
* API Key field now prefills with the saved value (hidden as dots by default), with a show/hide toggle to reveal it
* Settings response now returns the decrypted API key so the field can prefill on reload

= 1.2.3 =
* Defensive: settings state now spreads server data over defaults so partial responses still produce controlled inputs
* Clarify that the API key field is write-only by design (saved key is never shown back)

= 1.2.2 =
* Fix API Base URL setting not persisting (REST update handler was dropping the field before the sanitizer)

= 1.2.1 =
* Fix petition embed styling (CSS selectors now match the rendered card markup)
* Add styles for the sign modal so it overlays the page instead of appearing inline

= 1.2.0 =
* Add API Base URL setting (override for staging or self-hosted API)
* Add "How to Use" section on settings page with block and shortcode reference
* Fix block registration paths so blocks appear in the editor after install
* Fix API key validation to accept the actual 43-char base64url format
* Surface real backend error messages on save failures

= 1.0.0 =
* Initial release
* Petition embed block
* Petition creation block
* Shortcode support
* Admin settings page
