=== Platform Helm ===
Contributors: tshephojoel
Tags: internal linking, seo, broken links, content audit, schema
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 8.0
Stable tag: 0.14.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A modular content-operations and on-site SEO suite for WordPress: internal link building, link health, content auditing, and role-aware operations — done well.

== Description ==

**Platform Helm** is a lean, modular content-operations suite for WordPress. It does a focused set of high-leverage things excellently and stays out of your way the rest of the time. Every feature is a self-contained module you switch on or off independently — disabled modules register zero hooks and add zero overhead.

Built for solo bloggers and small content teams, Platform Helm complements your SEO plugin instead of fighting it: it reads Rank Math and Yoast focus keywords when present, sharpens your internal linking, audits your content, and gives you a real operational view of how your site connects to itself.

= Modules =

**Internal linking**

* **Internal Link Suggester** — In-editor suggestions for existing posts you could link to. Ignores image attributes, headings, and existing links, so every suggestion is real, linkable body text. One-click insertion in both the classic and block editors.
* **Bulk Suggestions** — Scan every published post at once (chunked over AJAX with a progress bar) and review all internal-link opportunities in one table. Dismiss a pairing to hide it everywhere.
* **Link Architect** — Bulk-build internal links to orphan pages. Paste orphan URLs, get keyword-matched source-post suggestions, approve in batches, and inject links with DOM-aware placement. Every modified post is backed up first — one-click restore per post.
* **Internal Link Health** — A snapshot report: orphan pages, total internal links, and broken internal links, with rescan and CSV export. Feeds the Command Center with real numbers, plus a per-post Link Summary meta box and optional weekly email alerts.

**SEO & content intelligence**

* **AI Assistant** — Connection settings for an OpenAI-compatible API (Groq recommended — free and privacy-friendly). The key is encrypted at rest and used only when you click an AI button in the admin; never on public page loads.
* **AI Visibility Check (AEO)** — An editor panel that scores an article's intro for AI-answer-engine visibility and can suggest a refined intro. Client-side scoring; nothing is saved.
* **AI Meta Generator** — Drafts an SEO meta title + description to copy into your SEO plugin. Suggestion-only; never outputs tags, so no conflicts.
* **Structured Data (Schema)** — HowTo + FAQ JSON-LD from an editor panel, emitted into the head.
* **Google Tag Manager** — Injects a GTM container correctly (script in head, noscript after body open) once you set a container ID.

**Search performance**

* **Search Console Connector** — Connects to Google Search Console (service-account or OAuth), caches Search Analytics on a daily cron, and powers cannibalization, content-gap, off-brand, index-coverage, and trend-monitor reports.
* **Content Auditor** — Scores every post on Search Console traffic + on-page health into a Keep / Refresh / Merge / Delete worklist. Batched, recommend-only, CSV export.

**Operations, team & site tools**

* **Persona Dashboards** — Role-tailored dashboard widgets for managers, editors, community managers, and authors. Multi-role aware; additive by default.
* **Role & Menu Manager** — Roles overview with capability counts and per-role admin-menu tidying. Presentational and fully reversible — never deletes roles or strips capabilities.
* **Activity Log** — Logging of logins, content changes, role and settings changes, and Helm link edits to a searchable, filterable log with CSV export and retention pruning.
* **Activity Intelligence** — Watches the Activity Log for statistical spikes/drops (e.g. a surge in deletions) with notice + email alerts, plus a shareable Staff Activity Report.
* **Audit Trail** — A tamper-evident, append-only timeline of status changes (and chosen meta fields) per post, shown right on the editor — who changed what, and when.
* **At-Risk Users** — Scores users on engagement (login recency, content activity, tenure, plus MemberPress when present) and flags those most likely to go inactive.
* **Link Assassin** — Bulk-remove broken outbound links from post content and Elementor data, batched with a progress bar; every post backed up first.
* **Ghost Purge** — Bulk-delete users in a role who haven't logged in for N months. Dry-run first; reassigns content before deletion.
* **Uploads Vault** — Protects form-upload subdirectories with .htaccess + index.php and a PHP fallback for nginx.
* **Login Branding** — An optional premium dark "Aurora" login page that derives its accent from your admin colour scheme and uses your Customizer logo.

= Why Platform Helm =

* **Lean and host-friendly.** No unbounded synchronous work, conservative cron use, transient caching. Assumes object cache and OPcache may be off.
* **Safe by default.** Deleting the plugin preserves all your data unless you explicitly opt in to a full teardown. Roles and role assignments are never touched.
* **Modular.** Toggle individual features; ship only what you need.
* **Integration-friendly, never coupled.** Optional adapters for Rank Math, Yoast, Elementor, and WooCommerce activate only when those plugins exist.
* **Security-first.** Every action is capability-checked, every form is nonce-protected, every input sanitised, every output escaped.

== Installation ==

1. Upload the `platform-helm` folder to `/wp-content/plugins/`, or install through the **Plugins → Add New** screen.
2. Activate the plugin.
3. Go to **Helm** in your admin sidebar.
4. Under **Helm → Modules**, enable the modules you want. Internal Link Suggester, Link Health, AI Visibility Check, and Schema are on by default; the rest are opt-in. Open any enabled module with its **View module** link.

== Frequently Asked Questions ==

= Does this replace my SEO plugin? =

No. Platform Helm sits beside Rank Math or Yoast. It reads their focus keywords to sharpen suggestions, but it never manages titles, meta descriptions, sitemaps, or canonical SEO — that's what SEO plugins do well.

= Where does the AI run, and is my key safe? =

You bring your own OpenAI-compatible API key (Groq is recommended — free and doesn't train on your data). The key is encrypted at rest using your site's salts and is used only when you click an AI button in the admin — never on public page loads or background requests.

= Do I need Google Search Console for the SEO reports? =

The Search Console Connector and Content Auditor are optional, off-by-default modules. Connect Search Console once and they cache analytics on a daily cron to power the cannibalization, content-gap, and audit reports. The rest of the plugin works without them.

= Will my data be lost if I delete the plugin? =

No. By default, deleting Platform Helm preserves every setting and any data it stored, so a reinstall picks up exactly where you left off. A full teardown only happens if you explicitly enable **"Remove all data on uninstall"** under Helm → Modules.

= Does the Role & Menu Manager edit my roles? =

No. It is presentational only — it hides admin-menu items per role for visual tidying, and never deletes roles or strips capabilities. Administrators are intentionally excluded so you cannot lock yourself out.

= Does Link Architect modify my content safely? =

Every post it modifies is backed up to post meta before any change is written, and you can restore any post with one click. Insertions are DOM-aware: they skip headings, existing anchors, scripts, and code blocks, and never match phrases that exist only in image alt text. Link Assassin (broken-link removal) and Content Auditor bulk actions follow the same backup-first approach.

= Will it work on a host without an object cache? =

Yes. The plugin assumes object cache and OPcache may both be off, and uses transient-based caching with conservative cron scheduling so admin loads stay cheap.

== Screenshots ==

1. The Command Center — a Site Health Overview score with prioritised issues, real-time linking metrics, and a recent-activity feed.
2. Modules — enable features with a clean toggle list; open any active module directly.
3. Internal Link Suggester — in-editor suggestions with one-click insertion.
4. Link Architect — keyword-matched suggestions across your library, batched insertion with progress, and per-post restore.
5. Internal Link Health — orphan pages, broken internal links, link totals, and CSV export.
6. Content Auditor — a Keep / Refresh / Merge / Delete worklist scored from Search Console and on-page signals.
7. Roles & Menus — role overview cards and an accordion-based menu visibility editor.

== Changelog ==

= 0.14.0 =
* New: Add-on framework — companion plugins can register their own modules into Helm → Modules (with a Tabler icon and a "View module" link) via the `platform_helm_module_icons` and `platform_helm_module_pages` filters.
* New: Helm Membership Ops companion add-on (optional, separate plugin) — adds a Sync Watchdog module that finds records whose integration sync failed and offers one-click retry; works with any automation/integration via configurable meta keys and a retry hook.
* Hardening: security and performance review pass across the Activity Intelligence, Audit Trail, and At-Risk Users modules (At-Risk Users now caches its user count on large sites).

= 0.13.0 =
* New: Search Console Connector — Google Search Console integration powering cannibalization, content-gap, off-brand, index-coverage, and trend-monitor reports.
* New: Content Auditor — Keep / Refresh / Merge / Delete worklist scored from Search Console traffic and on-page health, with CSV export.
* New: AI Insights — an on-demand analyst that answers SEO questions grounded in your own audit, Search Console, and link-health data.
* New: Activity Intelligence — anomaly detection (notice + email alerts) and a Staff Activity Report, built on the Activity Log.
* New: Audit Trail — tamper-evident, append-only change timeline on the post editor.
* New: At-Risk Users — engagement scoring to flag users likely to go inactive.
* Polish: design-system consistency pass across every admin screen; trimmed the Helm sidebar to Dashboard, Modules, Roles & Menus, and Tools (other module pages open via "View module"); Tabler icons now load from a local bundle when present; internal CSS class names de-branded.

= 0.12.0 =
* New: Login Branding, Link Assassin (broken outbound-link removal), Ghost Purge (inactive-user cleanup), and Uploads Vault.

= 0.11.0 =
* New: AI Assistant (encrypted, OpenAI-compatible), AI Visibility Check (AEO), AI Meta Generator, Structured Data (Schema), and Google Tag Manager.

= 0.10.0 =
* Changed: full admin UI rebuilt on a scoped design system (tokens, cards, stat tiles, badges, tables) with a new logo and shared UI helpers. Logic, data, and security unchanged.

= 0.9.0 – 0.9.1 =
* New: first-run Setup Wizard, Getting-started checklist, recent-activity feed; Activity Log CSV export + retention; Tools page (export/import settings, maintenance); Bulk Suggestions with dismiss memory; admin-bar Clear-cache.

= 0.8.0 =
* New: Architect ↔ Suggester feedback loop (never re-suggests a built link); weekly link-health alerts (in-dashboard, optional email).

= 0.7.0 =
* New: Gutenberg one-click internal-link insertion for the Suggester (no build toolchain).

= 0.6.0 =
* New: per-post Link Summary meta box; "Fix this" / bulk deep-links from Link Health into Link Architect.

= 0.4.0 – 0.5.0 =
* New: Persona Dashboards, Role & Menu Manager, Activity Log; optional clean-dashboard mode.

= 0.3.0 =
* New: Link Architect (bulk orphan-page link building with backup/restore) and Internal Link Health report.

= 0.2.0 =
* New: Internal Link Suggester with Yoast/Rank Math focus-keyword adapter and external-link rules.

= 0.1.0 =
* Initial framework: modular architecture, Command Center, module settings, safe uninstall.

== Upgrade Notice ==

= 0.14.0 =
Adds an add-on framework so optional companion plugins can plug modules into Helm, plus a security and performance hardening pass. Safe upgrade — settings and data are preserved.

= 0.13.0 =
Adds Search Console, Content Auditor, and AI Insights, plus a design-consistency pass and a shorter admin menu. Safe upgrade — settings and data are preserved.
