Subscription Workflow
Purpose
The subscription form replaces the heavier Fluent Forms plugin with a small, performance-focused custom PHP workflow. It captures a name and email, validates the address via Reoon API, and stores valid subscriptions in a protected CSV file.
Shortcode
[id86_subscribe]
Defined in the child theme functions.php. Renders a three-section card: ID86 logo, copy ("Stay in the loop"), and inline form with name, email, and subscribe button.
Front-End Rendering
The subscribe bar is rendered through the Site Footer GP Element (ID 3040). The shortcode output is placed inside:
<section class="id86-subscribe-bar">
<div class="id86-shell">
[id86_subscribe]
</div>
</section>
The shortcode wrapper HTML is generated by id86_render_subscribe_form() which outputs either the form or the thank-you message.
Submission Flow
Visitor submits name and email
-> honeypot validation (hidden field)
-> WordPress nonce validation (CSRF)
-> email syntax validation (is_email())
-> Reoon power-mode verification
-> If WP_Error: log to failed-verifications.csv, show error
-> If !is_safe_to_send: log to failed-verifications.csv, show error
-> If safe: save to subscribers.csv
-> on-page thank-you message:
"Thank you, {name}. We'll send you a monthly summary
of our latest instant documentation, cheatsheets, and updates."
Security Controls
| Layer | Mechanism |
|---|---|
| Honeypot | Hidden id86_hp field catches automated bots |
| Nonce | WordPress CSRF protection via id86_subscribe_nonce |
| Reoon | API verification requires is_safe_to_send = true (power mode) |
| Input sanitization | sanitize_text_field, sanitize_email, esc_attr, esc_html |
| CSV locking | flock(LOCK_EX) prevents concurrent write corruption |
| Directory protection | index.php placed in subscriber directory to prevent directory listing |
Form States
| State | Output |
|---|---|
| Initial | Form with name input, email input, subscribe button |
| Success | Thank-you message with user's name |
| Reoon error | Error message from Reoon API or "Please use a valid, deliverable email address." |
| Save failure | "Could not save. Please try again later." |
| Security failure | "Security check failed." or "Spam detected." |
Function Reference
| Function | Purpose |
|---|---|
id86_subscribe_dir() | Creates/returns subscriber storage directory (dirname(ABSPATH, 2) . "/id86-subscribers") |
id86_save_subscriber(name, email) | Appends name, email, IP, timestamp to subscribers.csv with flock |
id86_save_failed_subscriber_csv(name, email, reason) | Logs failed Reoon verifications |
id86_verify_email_reoon(email) | Calls Reoon API, returns parsed response or WP_Error |
id86_reoon_verification_is_safe(verification) | Checks is_safe_to_send flag |
id86_subscribe_phpmailer(phpmailer) | Configures PHPMailer with SMTP from WP options |
id86_render_subscribe_form(atts) | Shortcode handler routing the full submission lifecycle |
Auto-Responder Note
No auto-responder email is sent at present. SMTP configuration is fully retained and tested for a future opt-in email workflow. The id86_subscribe_phpmailer() and a future id86_send_subscriber_email() function inherited from the Opshell pattern are ready for use.