feat: Leave Feedback form — multi-select checkboxes + actually-working submit

The right-column "Leave Feedback" form on the About page has been
expanded from two radio buttons (user picked one of two) to seven
checkboxes (user can pick any), plus an optional message textarea.
The submit button — which previously called toggleSection() on
element IDs that never existed and did nothing — now AJAX-posts
to a new server-side handler that emails the site admin via
wp_mail().

FORM OPTIONS (checkboxes — multi-select)
- I have ideas to improve this plugin
- I need help with this plugin
- I found a bug
- I'd like to request a new feature
- I'd like to share my use case
- Just saying thanks
- Other

SUBMISSION FLOW
- Client-side: at least one checkbox OR a message is required; an
  inline hint shows otherwise.
- AJAX POST wp_notes_submit_feedback with topics[] + message + nonce.
- Server handler (manage_options capability + nonce checked)
  sanitizes input, allow-lists the seven topic keys, builds a
  plain-text email body (sender + site URL + plugin version +
  checked topics with pretty labels + message), and ships it to
  get_option('admin_email') via wp_mail() with Reply-To set to the
  submitting user.
- Inline success message replaces the form on success; inline error
  lets the user retry on failure.

The toggleSection() helper that the old broken handler used is kept
defined for now — it's no longer referenced anywhere on the About
page, so it's flagged in the changelog for a future Tier-2 removal
pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-25 08:13:52 +01:00
parent 184a124315
commit bc7d6986a8
3 changed files with 169 additions and 9 deletions
+38
View File
@@ -7,6 +7,44 @@ Format: [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/) — versi
## [Unreleased]
### Changed — Leave Feedback form (more options, multi-select, wired to email)
The right-column "Leave Feedback" form on the About page has been
expanded from two radio buttons to **seven checkboxes** (users can
pick more than one), a new optional message textarea, and a submit
button that **actually does something** — it AJAX-posts to a new
WP handler that emails the site admin via `wp_mail()`.
**Form options (checkboxes — multi-select):**
- I have ideas to improve this plugin
- I need help with this plugin
- I found a bug
- I'd like to request a new feature
- I'd like to share my use case
- Just saying thanks 🍀
- Other
**Submission flow:**
1. Client-side: at least one checkbox OR a message is required;
otherwise an inline hint shows.
2. AJAX POST `wp_notes_submit_feedback` with topics[] + message +
nonce.
3. Server-side handler (`manage_options` capability + nonce checked)
sanitizes input, allow-lists the topic keys, then builds a plain-
text email and ships it to `get_option('admin_email')` via
`wp_mail()`. Reply-To is set to the submitting user's email so
the admin can reply directly.
4. Email body includes: sender (display name + email + WP login),
site URL, plugin version, the checked topics (pretty-labelled),
and the message.
5. Inline success message replaces the form on success; inline
error message lets the user retry on failure.
The old radio-button + broken `toggleSection('feedback-form-...')`
logic that pointed at non-existent IDs has been replaced entirely.
The `toggleSection()` helper is kept defined but is now genuinely
unused on the About page — flagged for removal in a future Tier-2
pass.
### Changed — About page rewritten (content + layout)
The About page (`Settings → WP Notes → About`) has been rewritten
from "wall of nested toggle boxes with outdated content" to