diff --git a/CHANGELOG.md b/CHANGELOG.md index a2585e4..35c1246 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,28 @@ Format: [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/) — versi --- +## [3.4.1] — 2026-05-27 + +### Fixed — Restore button now sends you to the Active tab where the restored note lives + +After v3.4.0 introduced the Active/Completed tab strip, clicking **Restore** on a completed note appeared to "do something" but the restored note never showed up. David reported it as *"the complete log does not return to active."* + +Root cause: the Restore action handler in `wp_notes_page_callback()` (line ~1340) was the **only** action handler in the file without a `wp_redirect() + exit;` after its `update_option()` calls — every other handler (new note, mark-as-done single, mark-as-done bulk) had one. So Restore was relying on the page falling through and re-rendering, which used to work when both Active and Completed sections rendered on the same page (the user could just glance up to see the restored note in the Active section). v3.4.0's single-pane tab render exposed the latent bug: after Restore, the URL still said `?tab=completed`, so only Completed re-rendered (minus the now-restored note), and the restored note was invisible on Active. + +Fix: add the missing redirect to `admin.php?page=wp-notes` (which defaults to the Active tab) after the restore completes. The restored note now appears in its new home immediately. + +### Files changed + +- `wp-notes.php` — `wp_notes_page_callback()` Restore handler: added `wp_redirect(admin_url('admin.php?page=wp-notes')); exit;` after the two `update_option()` calls. Five-line change plus a load-bearing comment explaining the bug history so future-Claude doesn't reintroduce it. +- Plugin header `Version: 3.4.0 → 3.4.1`; `WP_NOTES_VERSION` constant updated to match. PATCH bump (bug fix, no API or behavioural changes beyond the fix itself). + +### Not changed + +- The other three action handlers (new note, mark-as-done) — they already had correct redirects; no need to touch. +- Storage model, tab structure, CSS — all unchanged from v3.4.0. + +--- + ## [3.4.0] — 2026-05-27 ### Added — Active / Completed tabs on the My Log page diff --git a/wp-notes.php b/wp-notes.php index 4a15ebc..8f55c1e 100644 --- a/wp-notes.php +++ b/wp-notes.php @@ -5,7 +5,7 @@ * Plugin Name: Logbook * Plugin URI: https://icanhelp.ie/wp-notes * Description: A lightweight task & logbook plugin for WordPress. Log your daily work, mark tasks done, and keep a tidy record inside the dashboard. Perfect for freelancers showing clients what's been delivered and students proving work to teachers. - * Version: 3.4.0 + * Version: 3.4.1 * Requires at least: 5.0 * Requires PHP: 7.2 * Author: IR240474 @@ -33,7 +33,7 @@ if (!isset($wp_notes_init)) { $wp_notes_init = true; // Plugin Constants - if (!defined('WP_NOTES_VERSION')) define('WP_NOTES_VERSION', '3.4.0'); + if (!defined('WP_NOTES_VERSION')) define('WP_NOTES_VERSION', '3.4.1'); if (!defined('WP_NOTES_FILE')) define('WP_NOTES_FILE', __FILE__); if (!defined('WP_NOTES_PATH')) define('WP_NOTES_PATH', plugin_dir_path(__FILE__)); if (!defined('WP_NOTES_URL')) define('WP_NOTES_URL', plugin_dir_url(__FILE__)); @@ -1342,7 +1342,7 @@ function wp_notes_handle_actions() { $done_notes = get_option('wp_done_notes', array()); $current_user = wp_get_current_user(); $new_done_notes = array(); - + foreach ($done_notes as $key => $note) { if (in_array($key, $_POST['done_ids'])) { $note['last_modified'] = current_time('mysql'); @@ -1352,9 +1352,21 @@ function wp_notes_handle_actions() { $new_done_notes[] = $note; } } - + update_option('wp_notes', $notes); update_option('wp_done_notes', $new_done_notes); + + // v3.4.1 fix: redirect to the Active tab so the restored note is + // visible in its new home. Without this redirect, the page falls + // through and re-renders with the URL's current ?tab=completed, + // so the user sees Completed (minus the now-restored note) and + // can't see the restored note on Active. The other action + // handlers above (new note, mark-as-done single, mark-as-done + // bulk) all redirect; restore was the odd one out. Pre-v3.4.0 + // this was masked because both sections rendered on the same + // page — the v3.4.0 single-pane tab render exposed it. + wp_redirect(admin_url('admin.php?page=wp-notes')); + exit; } // Handle edit note action