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

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

== Description ==

ActRight for WordPress allows you to embed petitions from the ActRight 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 `actright` folder to `/wp-content/plugins/`
2. Activate the plugin through the 'Plugins' menu
3. Go to Settings → ActRight and enter your API key
4. Add the ActRight blocks to your pages

== Frequently Asked Questions ==

= Where do I get an API key? =

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

= Does this work with the classic editor? =

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

= What happens to my data if I remove the plugin? =

Deactivating changes nothing. Your settings, Petition Pages and saved signatures all stay.

Deleting the plugin removes the data it owns: the settings (including the API key), cached petition data, the local signatures table, and the Petition Pages you created with it. Those pages are removed because each one is only a holder for a petition embed — with the plugin gone there is no way to view, edit or delete them.

Posts and pages of your own, where you placed a petition block or shortcode, are never deleted. The block or shortcode simply stops rendering.

To keep everything on delete — say you are moving to another host and will reinstall — add this to wp-config.php first:

`define( 'ACTRIGHT_KEEP_DATA_ON_UNINSTALL', true );`

== Changelog ==

= 1.26.0 =
* Fixed: a petition's decision makers are no longer cut off at 10. Up to 50 now show, which is the most a petition can have.
* Changed: with no count set, the decision-maker element and block now show all of them instead of the first 10. Set a number to show fewer.

= 1.25.0 =
* Fixed: the Create Petition block and shortcode could never create a petition — the API call sent snake_case field names to an endpoint that requires camelCase and rejects unknown fields, so every attempt failed with a validation error.
* Removed: the block's Default Tags setting. Tags no longer exist in the platform, and the value was silently discarded before the API was even called.

= 1.24.0 =
* Added: the Elementor Petition List widget now has an Arrangement setting (stacked or grid). The grid the shortcode and the block both offer could not be selected in Elementor at all before.
* Added: the Elementor Petition List widget can hide the signature count and the progress bar, which the Petition widget and the Petition List block already could.
* Fixed: show-signatures and show-progress had no effect on [actright type="list"]. Both were parsed and then dropped, so a list always showed the count and the bar.

= 1.23.4 =
* Fixed: colours picked with opacity in Elementor (8-digit hex) and hsl/hsla values now apply; they were silently dropped

= 1.23.3 =
* Fixed: Background, Padding, Radius, Shadow, Border and the typography settings now apply to the single-element widgets (Recent Signatures, Title, Count and the rest), which previously ignored most of them.
* Fixed: the Gap setting now spaces the recent-signature, decision-maker and share-button lists.
* Fixed: the Avatar size setting now applies to the petition starter's logo.

= 1.23.2 =
* Fixed: the Text colour now reaches headings, lists and quotes inside the petition body, and the sign form's field labels.
* Fixed: secondary text (creator line, counts, dates, decision-maker roles) now follows the Text colour instead of staying grey.
* Fixed: the global Style Kit now reaches the sign modal and the post-signature popups.
* Fixed: the sign form's focus ring and the modal's Sign button now follow the Accent and Button colours.

= 1.23.1 =
* Fixed: accept ar_test_/gs_test_ API keys — a valid key from a non-production API could not be saved.
* Fixed: saving a rejected API key or URL caused a PHP fatal (500) instead of showing the reason.
* Fixed: the Petition List Layout choice, wide/full alignment and spacing now reach the published page.
* Fixed: a malformed API response no longer renders an empty petition card reading "0 signatures".
* Fixed: API error text is no longer double-escaped, and its detail is shown only to administrators.
* Fixed: double-clicking Sign no longer stacks two modals; modal field ids are now unique.
* Fixed: the dashboard Signature Trend chart no longer shows a flat zero week from a missing endpoint.
* Added: per-IP rate limit on the public read endpoints.
* Added: signature data now appears in WordPress's Export/Erase Personal Data tools.

= 1.23.0 =
* Changed: hiding an element with the eye in Elementor's Structure panel now hides it on the published page as well, not only inside the editor. Elementor's own hide toggle is editor-only, which meant an element you hid and saved was still shown to visitors. Applies to every element on the page, not just ActRight ones, so nothing behaves inconsistently. Developers can restore the stock behaviour with the actright_elementor_respect_hidden_elements filter.
* Changed: the element shortcode is now [actright-el]. It was the last one still carrying the old name.
* Fixed: pages written with the plugin's older shortcode names render again. Renaming the shortcodes had left those pages printing shortcode text to visitors instead of the petition. The older names are still accepted, silently, so nothing has to be edited by hand.
* Fixed: petition links on the small card now follow the "Petition site URL" setting instead of a hard-coded address, so they match the links used everywhere else.
* Added: Elementor widgets for every ActRight element, in their own ActRight panel group.
* Added: Elementor widgets carry the same appearance controls, presets and Style Kit as the blocks and shortcodes.
* Fixed: deactivating the plugin left the /petitions/ rewrite rules behind, because the post type was still registered when the rules were flushed.
* Fixed: network-activating on multisite only set up one site; new sites on a network are now set up on creation.
* Changed: repeated lookups of the same petition in one page render now share a single API request.

= 1.22.6 =
* Changed: the plugin download now carries its version in the file name (actright-1.22.6.zip), so a saved or forwarded copy shows which release it is.

= 1.22.5 =
* Fixed: the petition selection dropdown in the block editor no longer disappears without explanation. When no API key is set, the request fails, or the account has no petitions, the block now says which of those it is — and links an administrator straight to the settings page instead of leaving only an empty slug field.
* Added: a dismissible admin notice while no API key is configured, so a fresh install points to the settings page instead of failing silently.
* Improved: the settings page opens with a three-step "Getting started" card, making it clear that a petition is chosen on the page in a block, not on the settings page.
* Improved: the "Petition slug" field now explains where to find a slug, with an example.
* Changed: deleting the plugin now also deletes the Petition Pages it created. Those pages only exist to render a petition embed from this plugin's data, so once the plugin is gone they cannot be viewed, edited or removed through the admin — they were left behind as rows nobody could reach. Options, cached data, post meta and the local signatures table were already removed. To keep everything instead, for example before moving hosts, define `ACTRIGHT_KEEP_DATA_ON_UNINSTALL` as true in wp-config.php before deleting the plugin. Deactivating the plugin still changes nothing.
* Fixed: on a multisite network, deleting the plugin cleaned up only one site. Every site in the network is now cleaned.

= 1.22.4 =
* Fixed: the "Start a Petition" creation form (petition-create block and `[actright type="create"]` shortcode) now renders styled on the front end. Its CSS was never enqueued, so the form and any applied Style Kit / preset had no effect; the form styles now live in the shared front-end stylesheet and consume the same `--gs-*` design tokens as the other components.

= 1.22.3 =
* Fixed: petition blocks (petition list, embed, container, elements) now render styled inside the block editor. The stylesheet is enqueued via `enqueue_block_assets` so it loads into the iframed editor canvas; previously it was front-end only, so editor previews showed full-size images and a collapsed layout.

= 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: [actright-el type="form"] and the form inside [actright-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 [actright-donate] and [actright-donate-button] now accept a class attribute, so the embed/button can be targeted from your own CSS — matching the class passthrough already on [actright], [actright-container], and [actright-el].
* Fixed: font-size set on a count element (e.g. [actright-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 "ActRight Petition Container" block (pick a petition, then drag in "ActRight Element" blocks), or wrap [actright-el] elements in [actright-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 ([actright-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 → ActRight → "Petition site URL".
* New: decision-maker "card" view ([actright-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, [actright-el], the [actright] 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. [actright 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 [actright] 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 → ActRight → 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 "ActRight 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 ActRight settings page.

= 1.16.0 =
* New: dedicated "How to Use" help page (Settings → ActRight 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 ActRight settings screen uses a responsive two-column layout on wider screens.

= 1.15.0 =
* New: advanced styling API so you can blend ActRight 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 [actright] 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 [actright 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 ActRight) accepts either a full URL (https://donorbox.org/your-campaign) or a bare slug (your-campaign).
* New: [actright-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 [actright-donate slug="your-campaign"] to target a specific one.
* New: [actright-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 → ActRight) 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 ActRight Petition block and the `[actright]` 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 ActRight 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 ActRight Petition block and the `[actright]` 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 — `[actright]` with `type="large-card|small-card|form|form-card|list"`. The separate `[actright_petition]` / `[actright_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 `[actright]` 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 ActRight 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: [actright_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 ActRight) 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 ("[actright_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
* 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
