=== MatrixInn GDPR & UK Compliance ===
Contributors: matrixinnsolutions
Tags: gdpr, cookie consent, privacy, compliance, uk gdpr
Requires at least: 5.8
Tested up to: 7.0
Stable tag: 1.0.5
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

GDPR & UK GDPR compliance: cookie consent banner, consent logging, Cookie Policy generator, and Google Consent Mode v2.

== Description ==

**MatrixInn GDPR & UK Compliance** helps you make your WordPress site compliant with:

* **EU GDPR** — General Data Protection Regulation
* **UK GDPR** — Post-Brexit UK data protection law (enforced by the ICO)
* **PECR** — Privacy and Electronic Communications Regulations (UK cookie rules)

Built by [MatrixInn Solutions](https://matrixinnsolutions.com) — a UK-focused compliance agency — to be lightweight, transparent, and fully ready for WordPress.org distribution.

= Cookie Consent Banner =

* **3 Layout Options** — Bottom/Top Bar, Centre Popup (with overlay), or Corner Box
* **Granular Consent** — 4 categories: Strictly Necessary, Functional, Analytics & Performance, Marketing & Advertising
* **Fully Customisable** — Custom title, message, button labels, and 5 colour pickers for background, text, and each button
* **"Powered by MatrixInn Solutions"** branding (toggleable)
* **Re-consent** — Automatically ask visitors to re-consent when you update your Cookie Policy

= Consent Management =

* **Consent Logging** — Records every consent choice with anonymised IP, timestamp, category breakdown, page URL, and policy version
* **Admin Consent Logs** — Stats dashboard (Total / Accepted / Declined / Partial), filterable table, and one-click clear
* **Cookie Preferences Modal** — Let visitors manage individual cookie categories at any time via a floating button

= Cookie Policy Generator =

* Auto-generates a Cookie Policy based on your business details and active categories
* Creates or updates a WordPress page with one click
* Bumps the policy version automatically to trigger re-consent from existing visitors

= Google Consent Mode v2 =

* Outputs GCM v2 `default deny` signals before any other scripts (priority 1 in `wp_head`)
* Fires `gtag('consent','update',...)` on every consent action
* Covers: `analytics_storage`, `ad_storage`, `ad_user_data`, `ad_personalization`, `functionality_storage`
* Enables `ads_data_redaction` and `url_passthrough` automatically

= Data Subject Rights =

* **Data Export Form** — Shortcode `[matrixinn_gdpr_export]` — users request a copy of their data
* **Data Erasure Form** — Shortcode `[matrixinn_gdpr_erasure]` — users request data deletion
* Hooks into WordPress core **Tools → Export Personal Data / Erase Personal Data**
* Automatically adds suggested privacy policy content to WP's privacy policy builder

= Developer-Friendly =

* No external dependencies — pure WordPress APIs
* Clean, namespaced PHP classes
* GPL-2.0+ licensed — free to use and modify
* Translation-ready with full `.pot` file support
* Complete uninstall — drops database table and removes all options on plugin deletion

== Installation ==

1. Upload the `matrixinn-gdpr` folder to `/wp-content/plugins/`, or install via **Plugins → Add New** in WordPress admin.
2. Activate the plugin through the **Plugins** menu.
3. Go to **GDPR Compliance** in your admin sidebar.
4. Under **General**, set your Business Name, Data Controller Email, and select your Privacy Policy page.
5. Under **Cookie Banner**, choose your preferred layout, position, and colours.
6. Under **Cookie Categories**, enable or disable the categories you use.
7. Click **Cookie Policy → Generate / Update Page** to create your Cookie Policy page.
8. Optionally add `[matrixinn_gdpr_export]` and `[matrixinn_gdpr_erasure]` shortcodes to your Privacy Policy page.

== Frequently Asked Questions ==

= Does this plugin make my site fully GDPR compliant? =

This plugin provides the essential technical tools for GDPR compliance — cookie consent, consent logging, data request forms, and policy generation. Full compliance also requires appropriate privacy policies, data processor agreements, and organisational measures. We recommend consulting a legal professional for your specific situation.

= What is the difference between EU GDPR and UK GDPR? =

After Brexit, the UK retained GDPR principles in its own "UK GDPR" legislation, enforced by the ICO (Information Commissioner's Office). This plugin covers both — it is suitable for sites with EU and/or UK visitors.

= What is PECR? =

The Privacy and Electronic Communications Regulations (PECR) are UK rules that specifically require informed consent before placing non-essential cookies. This plugin handles PECR compliance through its granular consent banner.

= Does this plugin work with Google Analytics 4? =

Yes. Enable Google Consent Mode v2 under the GCM tab to ensure consent signals are sent correctly to Google.

= Does this plugin support Google Consent Mode v2? =

Yes. Enable it under **Settings → Google Consent Mode**. The plugin outputs `default deny` signals in `wp_head` before any other scripts, and fires `gtag('consent','update',...)` whenever a visitor makes a choice.

= Is this plugin compatible with caching plugins? =

Yes. The cookie check and banner display are handled client-side via JavaScript. For server-side caching plugins, exclude the cookie `minn_gdpr_consent` from cache variation rules if you are serving different content based on consent.

= Does this plugin work with WordPress Multisite? =

Yes, the plugin is compatible with WordPress Multisite installations.

= Where are consent logs stored? =

In a custom database table `wp_minn_gdpr_consent_log`. IP addresses are anonymised by default (last octet zeroed for IPv4, last 80 bits zeroed for IPv6).

= What happens when I uninstall the plugin? =

All plugin data is removed: the `wp_minn_gdpr_consent_log` table is dropped, and all plugin options (`minn_gdpr_*`) are deleted from `wp_options`.

= Where can I manage data export and erasure requests? =

Go to **Tools → Export Personal Data** or **Tools → Erase Personal Data** in your WordPress admin. These are built-in WordPress tools that this plugin hooks into.

== Screenshots ==

1. Cookie consent banner — Bottom Bar layout on the front end
2. Cookie consent banner — Centre Popup with overlay
3. Cookie consent banner — Corner Box layout
4. Cookie Preferences modal with 4 categories and granular toggles
5. Admin Settings — General tab
6. Admin Settings — Cookie Banner tab with colour pickers
7. Admin Settings — Cookie Categories tab with toggle switches
8. Consent Logs — stats dashboard and detailed log table
9. Cookie Policy Generator — live preview and one-click publish
10. Generated Cookie Policy page on the front end

== Changelog ==

= 1.0.3 =
* Removed: Script Manager feature removed for WordPress.org compliance
* Updated: readme.txt, screenshots, and FAQ to reflect removal

= 1.0.2 =
* Added: Overlay with blur effect behind Centre Popup layout
* Added: `ensure_defaults()` runs on `admin_init` to reliably seed default options on any install
* Fixed: Checkbox options (Consent Logging, Anonymise IP, Show Branding, etc.) not persisting correctly when unchecked — added hidden input fallback for all checkbox fields
* Fixed: Cookie category toggles (Functional, Analytics, Marketing) not activating in modal due to empty string stored in DB
* Fixed: Banner layout class missing on first load after install
* Improved: `sanitize_field()` now correctly converts string "0"/"1" to integer for checkbox options
* Version bump to bust CSS/JS browser cache

= 1.0.1 =
* Fixed: Cookie consent banner layouts (Popup, Corner) not positioning correctly due to CSS specificity conflict between `#minn-gdpr-banner` ID selector and layout classes
* Fixed: Added `!important` to all layout-specific CSS properties in `.minn-layout-popup` and `.minn-layout-corner`
* Fixed: Consent logging failing with "Unknown column 'categories_json'" — activator now always drops and recreates tables on activation to ensure fresh schema
* Fixed: `TEXT DEFAULT NULL` incompatibility with `dbDelta()` — changed to `VARCHAR NOT NULL DEFAULT ''`
* Fixed: Null `user_id` with `%d` format — now defaults to integer `0`
* Fixed: Settings page fields appearing empty — activator now checks for both `false` and `''` before setting defaults
* Version bump for CSS cache busting

= 1.0.0 =
* Initial release
* Cookie consent banner with Accept All / Accept Selected / Decline All / Manage Preferences
* 3 banner layouts: Bottom/Top Bar, Centre Popup, Corner Box
* 4 consent categories: Strictly Necessary, Functional, Analytics & Performance, Marketing & Advertising
* Granular Cookie Preferences modal with per-category toggles
* Floating "Manage Preferences" button after consent
* Consent logging with IP anonymisation (IPv4 and IPv6)
* Admin consent logs with stats dashboard (Total / Accepted / Declined / Partial)
* Script Manager — block third-party scripts until consent is given
* Cookie Policy Generator — auto-generates and publishes a Cookie Policy page
* Google Consent Mode v2 support (default deny + update signals)
* Re-consent on policy version change
* Data export request shortcode `[matrixinn_gdpr_export]`
* Data erasure request shortcode `[matrixinn_gdpr_erasure]`
* WordPress core privacy tools integration (Tools → Export / Erase Personal Data)
* Privacy policy helper content
* Translation-ready
* Clean uninstall (drops tables, removes all options)
* "Powered by MatrixInn Solutions" branding (toggleable)

== Upgrade Notice ==

= 1.0.2 =
Recommended update — fixes checkbox settings not saving correctly and cookie categories not appearing in the consent modal on fresh installs.

= 1.0.1 =
Recommended update — fixes banner layout positioning and consent logging database schema issues.
