=== SML Sentinel ===
Contributors: scarlettmedialab
Tags: activity-log, logging, security, audit, monitoring
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.2.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

SML Sentinel (Scarlett Media Lab) records the lifetime activity cycle of any area of a WordPress site, for both site owners and developers.

== Description ==

SML Sentinel is an activity log from Scarlett Media Lab. It does not only watch what users click. It records the lifetime of an area of a WordPress site — sign-ins, content, plugins, files, errors, and housekeeping — in one place, written so both non-technical site owners and developers can use it.

You get four screens: **Overview**, **Activity Logs**, **Event Registry**, and **Settings**. Administrators also get a first-run **Quick Setup** wizard. Editors who can edit published posts can open Overview and Activity Logs; Event Registry and Settings stay with administrators.

= What it records =

Built-in events cover:

* Sign-ins, sign-outs, failed sign-ins, new accounts, and profile updates
* Posts and pages published, updated, or deleted; comments posted, approved, or deleted
* Files added to or removed from the Media Library
* Plugin, theme, and WordPress core changes
* PHP and WordPress errors, including fatal errors, database errors, and memory pressure
* Sentinel’s own housekeeping (cleanup, anonymisation, deletion requests)

If WooCommerce, Contact Form 7, WPForms, or Yoast SEO is active, Sentinel records a small set of those plugin’s events as well (order and payment changes, form submissions without message text, SEO updates). Gravity Forms is not recorded.

You can pause individual event types in Event Registry. You can also skip everyday actions from chosen user roles; critical system errors are still stored. By default, administrator everyday actions are not recorded.

This is a log, not a firewall. It does not block brute-force logins or scan for malware.

= Admin screens =

* **Overview** — today’s counts, a week of volume, a heatmap, site health, and recent activity
* **Activity Logs** — searchable history with filters and a detail drawer
* **Event Registry** — the catalogue of what Sentinel can detect, grouped (sign-ins, security, content, plugins and themes, errors, privacy, system, plus integration groups when those plugins are present)
* **Settings** — data and retention, privacy and access, notifications, performance, export and API, maintenance

= Email =

Mail uses WordPress’s mailer. If the site cannot send email, these switches will not fix delivery.

* **Urgent alerts** — one email when a *critical* event happens (PHP fatal, database or configuration error, critical memory use, a watched file change, or Sentinel’s own logging rate limit being exceeded). The same type stays quiet until the next day.
* **Daily summary** — one morning briefing: failed sign-ins (counted, not emailed one by one), what changed, and errors
* **Weekly summary** — optional; same briefing template rolled up for the week. Off unless you turn it on.

There is no per-event email filter maze.

= Retention, privacy, and export =

* Live rows can be archived by age and by a maximum live count. Archived rows can be kept or deleted on a schedule.
* Optional IP logging on new events. Optional anonymisation of older records (IPv4 and some email or username fields in payloads). IPv6 is not masked today. Anonymisation cannot be undone.
* Optional deletion-request form via the `[sentinel_data_deletion_request]` shortcode. Logged-in users can ask; an administrator still has to approve. This does not delete the WordPress account. There is no per-user export of Sentinel data; administrators can download activity from Settings → Export & API (CSV, JSON, or XML).
* Optional read-only REST access (`sentinel-plugin/v1`) behind an API key you generate in Settings.

= Files and performance =

Optional daily check of `wp-config.php` and `.htaccess`. That is a scheduled hash check, not live file watching.

Optional batch writes, a cap on how many events are stored per minute or hour (this protects the database; it is not login protection), and optional memory-pressure handling. Most sites can leave these as they are.

= Bundled libraries =

* Chart.js 4.5.1 (MIT) is included locally at `admin/js/vendor/chart.min.js`. Upstream source: https://github.com/chartjs/Chart.js
* Inter and Poppins (SIL Open Font License) are included at `admin/fonts/`. See `admin/fonts/OFL.txt`.

== Installation ==

1. Upload the `sml-sentinel` folder to `/wp-content/plugins/`.
2. Activate SML Sentinel from the Plugins screen.
3. Administrators see Quick Setup on first run (monitoring and privacy presets, a preview, then apply or skip). You can reopen it from Settings.
4. Open **Sentinel** in the admin menu: Overview, Activity Logs, Event Registry, and Settings.

== Frequently Asked Questions ==

= What events does Sentinel log by default? =

Sign-ins and failed sign-ins, content and comment changes, Media Library uploads and deletions, plugin and theme changes, WordPress upgrades, PHP and WordPress errors, and Sentinel privacy or housekeeping events. WooCommerce, Contact Form 7, WPForms, and Yoast SEO add their own types when those plugins are active. You can pause types in Event Registry.

= Does it email me for every failed login? =

No. Failed sign-ins are counted in the daily summary. Urgent mail is only for critical events, and the same type will not email again until the next day.

= Can I add custom events? =

No. Built-in types can be paused. Integrations register their own keys when those plugins are active. There is a `sentinel_log_event()` helper for the events Sentinel already knows.

= Is Sentinel compatible with multisite? =

Sentinel is built for a single site. It is not tested as a network-activated plugin.

= Does Sentinel block attacks? =

No. It records activity and can email you. Rate limiting in Settings caps how many *log writes* Sentinel will store, not visitor logins.

= How do deletion requests work? =

Turn on the deletion-request shortcode in Settings → Privacy & access, then put `[sentinel_data_deletion_request]` on a page. A logged-in user can submit a request. An administrator must approve it. It does not delete the WordPress user account.

= Can I watch every file on the site? =

No. Free watches `wp-config.php` and `.htaccess` once a day when that switch is on.

= Will logging slow the site down? =

Writes go into Sentinel’s own tables. If volume is a problem, Settings → Performance can queue writes in batches and cap how many events are stored per minute.

= Is there a REST API? =

Yes, read-only, off by default. Enable it in Settings → Export & API, generate a key, and send `X-Sentinel-API-Key` (or an `api_key` query parameter). Endpoints: `/wp-json/sentinel-plugin/v1/logs`, `/stats`, and `/events/types`. `/stats` returns summary counts only.

== Screenshots ==

1. Overview — counts, week volume, heatmap, and recent activity
2. Activity Logs — filters and the event detail drawer
3. Event Registry — catalogue of event types, including pause
4. Settings — retention, privacy, notifications, and export
5. Email — urgent alert and daily briefing

== Changelog ==

= 1.2.0 =
* Rewrite the admin around Overview, Activity Logs, Event Registry, and Settings
* Quiet email: urgent mail only for critical events; daily briefing for the rest; optional weekly uses the same briefing template
* Failed sign-ins are counted in the daily briefing instead of emailed one by one
* Quick Setup: monitoring and privacy presets with a change preview (no licence step)
* Privacy controls: optional IP logging, anonymise older records, deletion-request shortcode
* Integrations when those plugins are active: WooCommerce, Contact Form 7, WPForms, Yoast SEO
* Media Library uploads and deletions (pause either type in Event Registry)
* Daily watch of wp-config.php and .htaccess (optional)
* Export live or archived activity as CSV, JSON, or XML; optional read-only REST API
* Activity omits ordinary REST 404s and cookie REST “sign-ins”; repeated WordPress errors of the same type are collapsed

== Upgrade Notice ==

= 1.2.0 =
Email is quieter: urgent mail only for critical events, plus a daily briefing. Per-event notification filters from earlier 1.1.x releases are gone. Review Settings → Notifications after you update.
