8 Commits

Author SHA1 Message Date
ranger 9df37a35e8 fix: Restore actually works now — handler was checking wrong $_POST key (v3.4.2)
v3.4.1 added a redirect to the Restore handler thinking that was
the missing piece. It wasn't — the entire if-block was dead code.

The per-row Restore form in inc/wp-notes-display.php sends a
hidden $_POST['note_id'] (singular) when clicked. The handler in
wp_notes_page_callback() was checking for $_POST['done_ids']
(plural), an array of IDs from bulk-action checkboxes that were
removed back in v3.1.0. The mismatch meant the handler's
isset($_POST['done_ids']) guard was always false → handler body
never ran → clicking Restore was a no-op all the way back to
v3.1.0.

Pre-v3.4.0 this was masked because the page re-rendered with
both Active and Completed sections visible, so users might assume
they'd misclicked. v3.4.0's single-pane tab render made the
no-op symptom unmissable; v3.4.1's redirect was a phantom fix
because it lived inside the unreachable block.

Fix: rewrite the handler to match the working single-note
mark-done handler pattern that lives directly above it —
isset(note_id), absint, isset($done_notes[$note_id]) lookup,
move with restored_by annotation, redirect to Active tab. Adds
a load-bearing comment recording the bug history so future-
Claude doesn't reintroduce the dead-code structure.

Lesson recorded in the changelog: when a handler appears to
"do nothing", verify the $_POST keys match BEFORE assuming the
issue is downstream (missing redirect, failed update, etc.).
2026-05-26 09:10:57 +01:00
ranger 431c31a95b fix: Restore button now sends you to Active tab where the note lives (v3.4.1)
After v3.4.0 introduced the Active/Completed tab strip, clicking
Restore on a completed note appeared to do nothing — the restored
note never showed up. David: "the complete log does not return
to active."

Root cause: the Restore handler in wp_notes_page_callback() was
the only action handler 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 relied on the page
falling through and re-rendering, which used to work when both
Active and Completed sections rendered on the same page (user
could 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 says ?tab=completed, so only Completed
re-renders (minus the now-restored note), and the restored note
is invisible on Active.

Fix: add the missing redirect to admin.php?page=wp-notes (defaults
to Active tab) after the restore completes. The restored note now
appears in its new home immediately.

Patch bump — bug fix only, no API or behavioural changes beyond
the fix itself. Other handlers, storage model, tab structure, and
CSS are unchanged.
2026-05-26 09:07:27 +01:00
ranger c5d8a34296 feat: Active/Completed tabs on My Log page (v3.4.0)
Replaces the two stacked sections (Active above, Completed below)
on the main Logbook page with a single-pane WP-admin tabbed view
using the native subsubsub pattern (same as Posts/Comments/Plugins).

- Two tabs: Active (N) | Completed (M) with live counts
- URL-driven state via ?tab=active|completed; bookmarkable,
  refresh-stable, back-button works, invalid values fall back to
  Active server-side via whitelist + sanitize_key
- No JavaScript — each tab is a hyperlink built with add_query_arg
- WP-admin core CSS handles .subsubsub + .current; only a small
  margin block added in wp-notes-styles.php
- Single-pane render: only the selected tab's section is in the
  DOM, so no flash-of-wrong-content
- "Add a Note" form stays visible on both tabs for UI consistency

Flagged in the 2026-05-25 UX audit as the highest-payoff next move
(Tier 3 item #7). When the v4 timer/time_logged field ships, the
structure can extend to 3 tabs (TODO/IN PROGRESS/Completed) in
the same place; without it, an IN PROGRESS tab would always be
empty, so v3.4.0 ships the 2-tab version matching the current
data model.

Storage model unchanged — Active and Completed remain in their
separate options (wp_notes, wp_done_notes). The
wp_notes_display_notes($type) function is unchanged.

MINOR bump: new feature, no breaking changes.
2026-05-26 09:00:15 +01:00
ranger bd8c5f2340 ux: replace generic cog admin-menu icon with closed-book (v3.3.5)
The WordPress admin sidebar showed "Logbook" with the generic
cog wheel icon (dashicons-admin-generic) — fine for a settings
page, off-brand for a plugin whose entire identity is "logbook".

Swapped to dashicons-book-alt (closed book) — the most literal
possible match in the Dashicons set, and visually reinforces the
brand at the first place users see the plugin every day.

Alternatives also viable (commented in the changelog for future
reference): dashicons-edit (pencil), dashicons-clipboard,
dashicons-welcome-write-blog, dashicons-format-aside.

VERSION
- wp-notes.php header 3.3.4 → 3.3.5
- WP_NOTES_VERSION constant 3.3.4 → 3.3.5
- About page version-history leads with v3.3.5; v3.3.4 demoted.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 10:09:49 +01:00
ranger ead5bbcd2c release: 3.3.3 → 3.3.4 — rename Gitea repo a-wp-notes-v3 → a-logbook
The repo's old name was a holdover from the v3-of-A-WP-Notes
archival era. With the plugin firmly identifying as "Logbook" now,
the repo and the local working folder should match.

CHANGES IN-CODE
- inc/wp-notes-updater.php: WP_NOTES_GITEA_REPO constant
  a-wp-notes-v3 → a-logbook. Update checker now hits
  https://git.davidtkeane.com/api/v1/repos/ranger/a-logbook/...
  on every check. Override-able via define() in wp-config.php if
  the repo ever moves again.
- inc/wp-notes-about.php: "View the full CHANGELOG.md →" link on
  the version-history card now points at the new repo path.
- Local working folder on M3 renamed
  /Users/ranger/scripts/Gitea/a-wp-notes-v3-archive → a-logbook.
  .git/config survived; remote URL will be updated separately.

UNCHANGED (zero-migration commitment continues)
- Plugin slug 'wp-notes'.
- Plugin text domain 'a-wp-notes'.
- All wp_notes_* function names, WP_NOTES_* constants, DB option
  keys, user_meta keys, file names inside the plugin folder.
- Historical CHANGELOG references to a-wp-notes-v3 stay as
  truthful history of the v3.2.0 era.

VERSION BUMP
- wp-notes.php header Version: 3.3.3 → 3.3.4
- WP_NOTES_VERSION constant: 3.3.3 → 3.3.4
- About page version-history leads with v3.3.4; v3.3.3 demoted.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 09:54:27 +01:00
ranger e51b087545 release: 3.3.2 → 3.3.3 — verification bump to test the "Check now" flow end-to-end
Pure version increment with no functional changes. Lets David's
Local install (currently on v3.3.2) hit the "Check now" button in
Settings → Updates and verify the panel correctly reports a real
version delta — should render "v3.3.3 available — Download .zip"
with a working download link to the source archive on Gitea.

After the test passes, `git pull` brings the local install to
v3.3.3 and the same panel should flip back to "You are up to date
(v3.3.3)".

VERSION
- wp-notes.php header 3.3.2 → 3.3.3
- WP_NOTES_VERSION constant 3.3.2 → 3.3.3
- About page version-history leads with v3.3.3 as latest (with a
  cheeky "if you can see this line, you successfully pulled the
  test release" note); v3.3.2 demoted to previous entry.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 09:47:25 +01:00
ranger 1c93c82ef5 fix: update checker — fall back to /tags when no formal Gitea Release exists (v3.3.2)
The v3.3.0 update checker only queried Gitea's /releases/latest
endpoint, which requires a formal Release object (created via the
Gitea web UI with optional notes + zip assets attached). A plain
"git tag v3.3.x && git push --tags" from the terminal does NOT
create that Release object — so the checker kept returning "No
releases tagged on the Gitea repo yet" even when tags existed.

wp_notes_fetch_latest_release() now falls back to the
/tags?limit=1 endpoint when /releases/latest returns 404 (or any
non-200). It synthesises a release-like payload from the newest
tag — tag_name, html_url pointing at the tag view, tag message as
the body, empty assets[] so the existing download-URL logic falls
through to Gitea's source-archive URL pattern (/archive/<tag>.zip).

Net effect: the "Check now" button now finds the latest version
whether David creates formal Gitea Releases OR just pushes tags
with "git push --tags". No workflow change required.

Discovered while diagnosing why "Check now" wasn't seeing today's
v3.1.0/v3.2.0/v3.3.0/v3.3.1 tags (just pushed in this session)
— the tags were there, the formal Release objects were not.

KNOWN LIMITATION (not a bug — flagged)
The Gitea repo ranger/a-wp-notes-v3 is currently private. Anonymous
API requests get a 404 (Gitea's standard behaviour for private
repos). The updater code is correct but can't actually reach the
API on a private repo without authentication. Fix: change the
repo visibility to public on Gitea — appropriate anyway for a
GPL-licensed plugin headed for the WordPress.org marketplace.

VERSION BUMP
- wp-notes.php header 3.3.1 → 3.3.2
- WP_NOTES_VERSION constant 3.3.1 → 3.3.2
- About page version-history leads with v3.3.2; v3.3.1 demoted

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 09:29:33 +01:00
ranger 3667b7a154 release: 3.3.0 → 3.3.1 — drop "WP" prefix, plugin is now just "Logbook"
David's call after a short discussion about WordPress.org marketplace
considerations. WP.org's trademark policy historically discourages
plugins implying official endorsement via a "WP" prefix and has been
known to request rename during submission review. Dropping it now
makes the name cleaner AND sidesteps that future hurdle if/when the
plugin lands on the marketplace.

CHANGES
All user-facing brand mentions: WP Logbook → Logbook across:
- Plugin header (Plugin Name + docblock)
- Admin menu top-level
- Admin sidebar submenu label still "My Log" (already prefix-free)
- Admin bar count menu
- Dashboard widget title
- Settings page H1
- Main page H1
- About page intro card + "What Logbook does" card heading
- Email feedback subject + body intro
- Legacy feedback.php subject lines
- error_log() prefix [WP Logbook] → [Logbook]
- Updater panel description text
- styles.php docblock

VERSION
- wp-notes.php header Version: 3.3.0 → 3.3.1
- WP_NOTES_VERSION constant: 3.3.0 → 3.3.1
- About page version-history card gets new top entry for v3.3.1
  with green "latest" pill; v3.3.0 demoted to previous entry
- CHANGELOG header line tracks the full naming lineage now:
  A-WP-Notes (≤v3.1.0) → WP Logbook (v3.2.0-v3.3.0) → Logbook
  (v3.3.1+)

NOTABLY NOT CHANGED
- Historical CHANGELOG entries for v3.2.0 still say "WP Logbook" —
  that was the correct name at the time, rewriting would be
  revisionist.
- Same zero-migration commitment: internal function names,
  constants, DB option keys, user_meta keys, file paths, plugin
  slug 'wp-notes', and text domain 'a-wp-notes' all unchanged.
- Pure user-facing string change. No data migration, no behaviour
  change. Existing installs see "Logbook" appear on next page
  refresh.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 09:13:51 +01:00
7 changed files with 393 additions and 71 deletions
+226 -1
View File
@@ -1,6 +1,6 @@
# Changelog
All notable changes to **WP Logbook** (formerly **A-WP-Notes** through v3.1.0) are documented here.
All notable changes to **Logbook** (formerly **A-WP-Notes** through v3.1.0, then **WP Logbook** in v3.2.0v3.3.0) are documented here.
Format: [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/) — versioning: [SemVer](https://semver.org/).
---
@@ -9,6 +9,231 @@ Format: [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/) — versi
---
## [3.4.2] — 2026-05-27
### Fixed — Restore actually works now (v3.4.1 was incomplete)
David retested after v3.4.1 and reported the same symptom: *"the restore still not working."*
Root cause (the real one): the per-row Restore form in `inc/wp-notes-display.php` sends a hidden `$_POST['note_id']` (singular) when the button is clicked — but the handler in `wp_notes_page_callback()` was checking for `$_POST['done_ids']` (plural), an array of IDs that used to come from bulk-action checkboxes **removed in v3.1.0**. So the handler's `isset($_POST['done_ids'])` guard was always false, the handler body never ran, and clicking Restore was a no-op all the way back to v3.1.0. The bug was masked before v3.4.0 because the page re-rendered with both Active and Completed sections visible, so the user could see the (unchanged) completed note still sitting there and assume they'd misclicked. v3.4.0's single-pane render made the no-op symptom unmissable.
The v3.4.1 redirect added inside the handler was syntactically correct but never reached — the entire `if` block was dead code.
Fix: rewrite the handler to match the working **single-note** mark-done handler pattern that lives just above it:
- Check `isset($_POST['note_id'])` (singular) instead of `done_ids` (plural array)
- `absint()` the ID for sanitization
- `isset($done_notes[$note_id])` lookup instead of iterating with `in_array()`
- Move the note across with the existing `restored_by` annotation
- Keep the redirect-to-Active-tab from v3.4.1
The handler now mirrors the pattern of the mark-done handler that's been working all along.
### Why this took two attempts to fix
v3.4.1's diagnosis stopped at the missing redirect — which was real but not load-bearing because the handler body was unreachable. Lesson recorded: when a handler appears to "do nothing", verify it's being entered at all (matching `$_POST` keys) before assuming the issue is downstream (missing redirect, failed update, etc.).
### Files changed
- `wp-notes.php` — Restore handler rewritten (lines around 1340). The change replaces the old bulk-checkbox-era handler with a single-note handler matching the live form. Adds a load-bearing comment block recording the v3.4.1/v3.4.2 bug history so future-Claude understands why the structure mirrors mark-done.
- Plugin header `Version: 3.4.1 → 3.4.2`; `WP_NOTES_VERSION` constant updated to match. PATCH bump (bug fix).
### Not changed
- The display code in `inc/wp-notes-display.php` — the form was already correct; the handler was the one out of sync.
- The Active and Completed tabs, storage model, CSS, other handlers — all unchanged.
---
## [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
The main Logbook page used to render two stacked sections — Active notes from `wp_notes` above, Completed notes from `wp_done_notes` below. As the lists grew, this became a "wall of stacked sections" with Completed pushing content off the visible fold and users having to scroll past it to scan their active work.
v3.4.0 replaces the stacked layout with a **single-pane tabbed view** using WordPress's native `subsubsub` filter-tab pattern (the same one Posts / Comments / Plugins admin pages use):
- **Two tabs**: `Active (N)` and `Completed (M)`. Counts in the labels match the actual list lengths.
- **URL-driven state**: `?page=wp-notes&tab=active` (default) and `?page=wp-notes&tab=completed`. Bookmarkable, refresh-stable, back-button works. Invalid tab values fall back to Active server-side.
- **No JavaScript**: each tab is a hyperlink. WP-admin core CSS handles the `.subsubsub` and `.current` styling; we just add a small top/bottom margin block.
- **Single-pane render**: only the selected tab's section is in the DOM, so no flash-of-wrong-content and no wasted markup.
- **"Add a Note" form stays visible on both tabs** — even from Completed you can think of something new to log.
This was flagged in the 2026-05-25 UX audit as the highest-payoff next move (Tier 3 item #7). When the v4 roadmap's timer / `time_logged` field ships, the tab structure can extend naturally to three tabs (TODO / IN PROGRESS / Completed) in the same place; for now, without that field, an IN PROGRESS tab would always be empty, so v3.4.0 ships the 2-tab version that matches the current data model.
### Files changed
- `wp-notes.php``wp_notes_page_callback()`: tab detection from `$_GET['tab']` (sanitized + whitelisted), `subsubsub` markup with link-builder via `add_query_arg`, single-pane conditional render of either the active or completed section. Replaces the previous two-stacked-section block.
- `inc/wp-notes-styles.php` — minor spacing (`margin: 12px 0 18px`) on `.subsubsub` so the tab strip has breathing room.
- Plugin header `Version: 3.3.5 → 3.4.0`; `WP_NOTES_VERSION` constant updated to match. MINOR bump (new feature, no breaking changes).
### Not changed
- Storage model — Active and Completed remain in their separate options (`wp_notes`, `wp_done_notes`).
- The `wp_notes_display_notes($type)` function in `inc/wp-notes-display.php` — already accepts the section type, no signature change needed.
- No new DB writes, schema changes, AJAX endpoints, or dependencies.
---
## [3.3.5] — 2026-05-25
### Changed — Admin-menu icon
The WordPress admin sidebar icon for Logbook is now
**`dashicons-book-alt`** (a closed book) instead of the generic
cog wheel (`dashicons-admin-generic`). The closed-book glyph is the
most literal possible match for the word "logbook" in the Dashicons
set — reinforces the brand identity at the first place users see
the plugin every day.
If you'd prefer a different icon, the line lives in
`wp-notes.php → wp_notes_admin_menu()` as the 7th arg to
`add_menu_page()`. Alternatives worth considering:
`dashicons-edit` (pencil), `dashicons-clipboard` (clipboard),
`dashicons-welcome-write-blog` (pencil over paper),
`dashicons-format-aside` (notes glyph). Full list at
https://developer.wordpress.org/resource/dashicons/
### Version bump
- wp-notes.php header 3.3.4 → 3.3.5
- WP_NOTES_VERSION constant 3.3.4 → 3.3.5
- About page version-history leads with v3.3.5; v3.3.4 demoted.
---
## [3.3.4] — 2026-05-25
**Repo renamed on Gitea: `a-wp-notes-v3` → `a-logbook`.** Also the
local working folder on M3: `/Users/ranger/scripts/Gitea/a-logbook`
(was `a-wp-notes-v3-archive`). The old repo name was a holdover
from the v3-of-A-WP-Notes archival era; with the plugin firmly
identifying as Logbook now, the repo and folder names should match.
### Changed
- **`inc/wp-notes-updater.php`** — `WP_NOTES_GITEA_REPO` constant
updated from `a-wp-notes-v3` to `a-logbook`. The update checker
now hits `https://git.davidtkeane.com/api/v1/repos/ranger/a-logbook/...`
on every check. (The constant remains override-able via
`define()` in `wp-config.php` if the repo ever moves again.)
- **`inc/wp-notes-about.php`** — "View the full CHANGELOG.md →"
link on the version-history card updated to the new repo path.
- **Local working folder on M3** renamed to `a-logbook` to match
the Gitea repo name. `.git/config` survived the move intact;
remote URL updated separately.
### Unchanged (zero-migration commitment continues)
- Plugin slug (`wp-notes`).
- Plugin text domain (`a-wp-notes`).
- All internal function names, constants (`WP_NOTES_*`), DB option
keys, user_meta keys, file names inside the plugin
(`wp-notes.php`, `inc/wp-notes-*.php`).
- Historical CHANGELOG references to `a-wp-notes-v3` (e.g. in the
v3.2.0 entry) stay as historical truth.
---
## [3.3.3] — 2026-05-25
**Verification bump.** Pure version increment to test the end-to-end
"Check now" flow against the now-publicly-hosted Gitea repo. No
functional changes. David's Local install (running v3.3.2) should
now see *"v3.3.3 available — Download .zip"* in the Settings →
Updates panel once "Check now" is clicked, confirming the update
mechanism works against a real version delta. After the test, he
can `git pull` to land on v3.3.3 and watch the same panel flip back
to *"You are up to date (v3.3.3)"*.
---
## [3.3.2] — 2026-05-25
### Fixed — update checker now works with tag-only workflows
The v3.3.0 update checker only queried Gitea's `/releases/latest`
endpoint, which requires a **formal Release object** (created via
the Gitea web UI with optional notes + zip assets). A plain
`git tag v3.3.x && git push --tags` from the terminal doesn't
create that Release object — so the checker kept returning *"No
releases tagged on the Gitea repo yet"* even when tags clearly
existed.
`wp_notes_fetch_latest_release()` now falls back to the
`/tags?limit=1` endpoint when `/releases/latest` returns 404 (or
any non-200). It synthesises a release-like payload from the
newest tag — `tag_name`, an `html_url` pointing at the tag view,
the tag message as the body, and an empty `assets[]` array so the
existing download-URL logic falls through to Gitea's source-archive
URL pattern (`/archive/<tag>.zip`).
**Net effect:** the "Check now" button now finds the latest version
whether David creates formal Gitea Releases OR just pushes tags
with `git push --tags`. No workflow change required.
### Known limitation (not a bug — flagged for awareness)
The Gitea repo `ranger/a-wp-notes-v3` is currently **private**.
Anonymous API requests get a 404 (Gitea's standard behaviour to
avoid leaking the existence of private repos). The updater code is
correct, but it can't actually reach the API on a private repo
without authentication. **Fix:** change the repo visibility to
public on Gitea (Settings → Visibility) — appropriate anyway for a
GPL-licensed plugin headed for the WordPress.org marketplace.
---
## [3.3.1] — 2026-05-25
**Naming: dropped the `WP` prefix. The plugin is now just `Logbook`.**
David's call after a short discussion about WordPress.org marketplace
considerations — WP.org's trademark policy historically discourages
plugins implying official endorsement via a `WP` prefix and has been
known to request a rename during submission review. Dropping it now
makes the name cleaner *and* sidesteps that future hurdle if/when
the plugin lands on the marketplace.
### Changed
- All user-facing brand mentions: `WP Logbook``Logbook` across
plugin header, admin menu, admin bar, dashboard widget, settings
H1, main page H1, About page intro, About page card heading,
feedback email subjects/body, error_log prefix, updater panel
copy, and styles docblock.
- About page version-history card gets a new top entry for v3.3.1
with the green "latest" pill; v3.3.0 demoted to the previous slot.
- CHANGELOG header line updated to track the full naming lineage:
*A-WP-Notes (≤v3.1.0) → WP Logbook (v3.2.0v3.3.0) → Logbook
(v3.3.1+)*.
### Notably NOT changed
- Historical CHANGELOG entries for v3.2.0 (the original "WP
Logbook" rebrand) still say "WP Logbook" — that was the correct
name at the time and rewriting it would be revisionist.
- Same zero-migration commitment as the v3.2.0 rebrand: internal
function names, constants, DB option keys, user_meta keys, file
paths, plugin slug, and text domain all unchanged. Pure
user-facing string change.
---
## [3.3.0] — 2026-05-25
**New feature: self-hosted update checker.** WP Logbook is hosted on
+2 -2
View File
@@ -40,10 +40,10 @@ function wp_notes_admin_bar_menu($wp_admin_bar) {
$notes = get_option('wp_notes', array());
$count = count($notes);
// Main WP Logbook menu item
// Main Logbook menu item
$wp_admin_bar->add_node(array(
'id' => 'wp-notes',
'title' => sprintf('WP Logbook <span class="count">%d</span>', $count),
'title' => sprintf('Logbook <span class="count">%d</span>', $count),
'href' => admin_url('admin.php?page=wp-notes'),
));
+29 -9
View File
@@ -2,7 +2,7 @@
// wp-notes-about.php
/**
* Function to display the "About" page for WP Logbook plugin.
* Function to display the "About" page for Logbook plugin.
*/
function wp_notes_about_page() {
?>
@@ -53,11 +53,11 @@ function wp_notes_about_page() {
<div class="wp-notes-about-intro">
<div class="wp-notes-about-intro__img">
<img src="<?php echo esc_url(WP_NOTES_URL); ?>assets/wp-notes-banner.jpg"
alt="WP Logbook banner">
alt="Logbook banner">
</div>
<div class="wp-notes-about-intro__body">
<h2>WP Logbook <span style="color:#646970; font-weight:400;">v<?php echo esc_html(WP_NOTES_VERSION); ?></span></h2>
<p>WP Logbook is a lightweight task &amp; logbook plugin for WordPress. Log your daily work, mark tasks as done, and keep a tidy record right inside the dashboard &mdash; perfect for freelancers showing clients what's been delivered.</p>
<h2>Logbook <span style="color:#646970; font-weight:400;">v<?php echo esc_html(WP_NOTES_VERSION); ?></span></h2>
<p>Logbook is a lightweight task &amp; logbook plugin for WordPress. Log your daily work, mark tasks as done, and keep a tidy record right inside the dashboard &mdash; perfect for freelancers showing clients what's been delivered.</p>
<p style="margin-bottom:0;">
<a href="<?php echo esc_url(admin_url('admin.php?page=wp-notes')); ?>" class="button button-primary">Go to My Log →</a>
</p>
@@ -101,10 +101,10 @@ function wp_notes_about_page() {
}
</style>
<!-- What WP Logbook does -->
<!-- What Logbook does -->
<div class="wp-notes-about-card">
<h2>What WP Logbook does</h2>
<p>WP Logbook is a lightweight task &amp; logbook plugin that lives entirely inside the WordPress admin. Type a note, format it with colour / size / font / emoji, mark it done when the work is finished, restore it later if you need to revisit. Everything is stored in the site's own database &mdash; nothing leaves your server.</p>
<h2>What Logbook does</h2>
<p>Logbook is a lightweight task &amp; logbook plugin that lives entirely inside the WordPress admin. Type a note, format it with colour / size / font / emoji, mark it done when the work is finished, restore it later if you need to revisit. Everything is stored in the site's own database &mdash; nothing leaves your server.</p>
<p>I built it for my own client work as a transparent &ldquo;here's what I did this week&rdquo; logbook, so customers can see clearly what they're paying for. It turned out to be just as useful for any small team or single user who wants notes attached to the WordPress dashboard rather than a separate app.</p>
</div>
@@ -125,7 +125,27 @@ function wp_notes_about_page() {
<h2>Version history</h2>
<ul>
<li>
<span class="ver">v3.3.0</span> &mdash; 25 May 2026 <span class="latest">latest</span><br>
<span class="ver">v3.3.5</span> &mdash; 25 May 2026 <span class="latest">latest</span><br>
New admin-menu icon: closed-book (<code>dashicons-book-alt</code>) replaces the generic cog wheel. Visually reinforces the &ldquo;Logbook&rdquo; identity in the WP sidebar.
</li>
<li>
<span class="ver">v3.3.4</span> &mdash; 25 May 2026<br>
Repo renamed on Gitea: <code>a-wp-notes-v3</code> &rarr; <code>a-logbook</code>. The plugin&rsquo;s update checker and the &ldquo;View on Gitea&rdquo; / &ldquo;View all releases&rdquo; / &ldquo;View full CHANGELOG&rdquo; links now point at the new path. Local folder also renamed to <code>a-logbook</code>. The plugin&rsquo;s internal storage and slugs are unchanged &mdash; no data migration.
</li>
<li>
<span class="ver">v3.3.3</span> &mdash; 25 May 2026<br>
Pure version bump to verify the end-to-end &ldquo;Check now&rdquo; flow against a publicly-hosted Gitea repo. No functional changes. If you can see this line, you successfully pulled the test release.
</li>
<li>
<span class="ver">v3.3.2</span> &mdash; 25 May 2026<br>
Update checker now falls back to Gitea's <code>/tags</code> endpoint when no formal Release object exists for the latest tag. Means a plain <code>git tag &amp;&amp; git push --tags</code> is enough to make the &ldquo;Check now&rdquo; button report a new version &mdash; no need to manually create a Release in the Gitea web UI.
</li>
<li>
<span class="ver">v3.3.1</span> &mdash; 25 May 2026<br>
Dropped the <code>WP</code> prefix &mdash; the plugin is now just <strong>Logbook</strong>. Cleaner name, also clears a potential WordPress.org trademark-policy hurdle if/when the plugin ever lands on the marketplace.
</li>
<li>
<span class="ver">v3.3.0</span> &mdash; 25 May 2026<br>
Self-hosted update checker. Settings &rarr; Updates panel polls the Gitea repo via its JSON API, compares against the running version, and shows a download link when a new release is tagged. Includes &ldquo;View on Gitea&rdquo; and &ldquo;View all releases&rdquo; quick links. No auto-install &mdash; manual download keeps things safe.
</li>
<li>
@@ -149,7 +169,7 @@ function wp_notes_about_page() {
Basic note functionality with the dashboard widget and styling options.
</li>
</ul>
<a class="wp-notes-about-changelog-link" href="https://git.davidtkeane.com/ranger/a-wp-notes-v3/src/branch/main/CHANGELOG.md" target="_blank" rel="noopener">View the full CHANGELOG.md →</a>
<a class="wp-notes-about-changelog-link" href="https://git.davidtkeane.com/ranger/a-logbook/src/branch/main/CHANGELOG.md" target="_blank" rel="noopener">View the full CHANGELOG.md →</a>
</div>
</div>
+3 -3
View File
@@ -1,6 +1,6 @@
<?php
/**
* Feedback Form for WP Logbook Plugin
* Feedback Form for Logbook Plugin
*
* This file contains the HTML and AJAX handling for the feedback form.
*/
@@ -95,7 +95,7 @@ function wp_notes_submit_feedback() {
// Example: Send feedback via email
$to = 'david@icanhelp.ie';
$subject = 'WP Logbook Feedback';
$subject = 'Logbook Feedback';
$body = "Name: $name\nEmail: $email\nMessage: $message";
$headers = array('Content-Type: text/plain; charset=UTF-8');
@@ -148,7 +148,7 @@ function wp_notes_submit_help() {
// Example: Send help request via email
$to = 'david@icanhelp.ie';
$subject = 'WP Logbook Help Request';
$subject = 'Logbook Help Request';
$body = "Name: $name\nEmail: $email\nMessage: $message";
$headers = array('Content-Type: text/plain; charset=UTF-8');
+9 -1
View File
@@ -6,7 +6,7 @@ if (!defined('ABSPATH')) {
}
/**
* Add required styles for WP Logbook
* Add required styles for Logbook
*/
function wp_notes_admin_styles() {
?>
@@ -198,6 +198,14 @@ function wp_notes_admin_styles() {
color: #3c763d;
}
/* v3.4.0 — Active/Completed tab strip on the My Log page.
WP-admin core already styles .subsubsub and .current;
we only need to add breathing room above + below. */
.wp-notes-page .subsubsub,
.wrap > .subsubsub {
margin: 12px 0 18px;
}
/* Responsive Design */
@media screen and (max-width: 782px) {
.wp-notes-formatting {
+34 -13
View File
@@ -1,6 +1,6 @@
<?php
/**
* WP Logbook — self-hosted update checker against the Gitea repo.
* Logbook — self-hosted update checker against the Gitea repo.
*
* Polls the Gitea Releases API for the latest tagged release and
* compares its tag (e.g. "v3.3.0") against WP_NOTES_VERSION.
@@ -18,7 +18,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
// Gitea repo coordinates — change here if the repo ever moves.
if ( ! defined( 'WP_NOTES_GITEA_HOST' ) ) { define( 'WP_NOTES_GITEA_HOST', 'https://git.davidtkeane.com' ); }
if ( ! defined( 'WP_NOTES_GITEA_OWNER' ) ) { define( 'WP_NOTES_GITEA_OWNER', 'ranger' ); }
if ( ! defined( 'WP_NOTES_GITEA_REPO' ) ) { define( 'WP_NOTES_GITEA_REPO', 'a-wp-notes-v3' ); }
if ( ! defined( 'WP_NOTES_GITEA_REPO' ) ) { define( 'WP_NOTES_GITEA_REPO', 'a-logbook' ); }
/**
* Convenience: full web URL of the repo / its releases page.
@@ -48,18 +48,44 @@ function wp_notes_fetch_latest_release( $force_refresh = false ) {
if ( is_array( $cached ) ) { return $cached; }
}
$api_url = WP_NOTES_GITEA_HOST . '/api/v1/repos/' . WP_NOTES_GITEA_OWNER . '/' . WP_NOTES_GITEA_REPO . '/releases/latest';
$response = wp_remote_get( $api_url, array( 'timeout' => 8 ) );
$base_api = WP_NOTES_GITEA_HOST . '/api/v1/repos/' . WP_NOTES_GITEA_OWNER . '/' . WP_NOTES_GITEA_REPO;
// Try /releases/latest first — that's the canonical endpoint when David
// has published a formal Gitea Release via the web UI (with notes + zip
// assets attached).
$response = wp_remote_get( $base_api . '/releases/latest', array( 'timeout' => 8 ) );
if ( is_wp_error( $response ) ) {
return null;
}
$code = (int) wp_remote_retrieve_response_code( $response );
$body = ( $code === 200 ) ? json_decode( wp_remote_retrieve_body( $response ), true ) : null;
// 404 = repo has no releases yet, OR private. Cache briefly and surface
// a friendly status to the UI.
if ( $code !== 200 ) {
// Fallback: if no formal Release exists (typical for tag-only workflows
// where you `git tag v3.3.1 && git push --tags` without using the web
// UI), hit /tags instead and synthesise a release-like payload from the
// newest tag. Gitea's /tags endpoint sorts by creation order, so [0] is
// the most recent.
if ( $code !== 200 || ! is_array( $body ) || empty( $body['tag_name'] ) ) {
$tags_response = wp_remote_get( $base_api . '/tags?limit=1', array( 'timeout' => 8 ) );
if ( ! is_wp_error( $tags_response )
&& (int) wp_remote_retrieve_response_code( $tags_response ) === 200 ) {
$tags = json_decode( wp_remote_retrieve_body( $tags_response ), true );
if ( is_array( $tags ) && ! empty( $tags[0]['name'] ) ) {
$body = array(
'tag_name' => $tags[0]['name'],
'html_url' => wp_notes_gitea_repo_url() . '/src/tag/' . rawurlencode( $tags[0]['name'] ),
'body' => isset( $tags[0]['message'] ) ? $tags[0]['message'] : '',
'published_at' => isset( $tags[0]['commit']['created'] ) ? $tags[0]['commit']['created'] : null,
'assets' => array(),
);
$code = 200;
}
}
}
// Still nothing usable? Surface a friendly status and short-cache.
if ( $code !== 200 || ! is_array( $body ) || empty( $body['tag_name'] ) ) {
$info = array(
'version' => null,
'html_url' => wp_notes_gitea_releases_url(),
@@ -72,11 +98,6 @@ function wp_notes_fetch_latest_release( $force_refresh = false ) {
return $info;
}
$body = json_decode( wp_remote_retrieve_body( $response ), true );
if ( ! is_array( $body ) || empty( $body['tag_name'] ) ) {
return null;
}
// "v3.3.0" → "3.3.0" so version_compare() against WP_NOTES_VERSION works cleanly.
$version = ltrim( (string) $body['tag_name'], 'vV' );
@@ -180,7 +201,7 @@ function wp_notes_render_updates_panel() {
<div class="wp-notes-updates" style="max-width:720px; margin-top:24px; padding:18px 20px; background:#fff; border:1px solid #ccd0d4; border-radius:4px;">
<h2 style="margin-top:0;">Updates</h2>
<p style="margin:0 0 12px;">
WP Logbook is self-hosted on Gitea. Click <strong>Check now</strong> to ask the repo whether there's a newer release than the one you're running.
Logbook is self-hosted on Gitea. Click <strong>Check now</strong> to ask the repo whether there's a newer release than the one you're running.
</p>
<p id="wp-notes-update-status" style="margin:0 0 12px;">
+90 -42
View File
@@ -1,11 +1,11 @@
<?php
/**
* WP Logbook — WordPress work-logbook plugin
* Logbook — WordPress work-logbook plugin
*
* Plugin Name: WP Logbook
* Plugin Name: Logbook
* Plugin URI: https://icanhelp.ie/wp-notes
* Description: A lightweight task &amp; 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.3.0
* Version: 3.4.2
* 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.3.0');
if (!defined('WP_NOTES_VERSION')) define('WP_NOTES_VERSION', '3.4.2');
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__));
@@ -44,7 +44,7 @@ if (!isset($wp_notes_init)) {
if (!function_exists('wp_notes_log_error')) {
function wp_notes_log_error($message) {
if (defined('WP_DEBUG') && WP_DEBUG === true) {
error_log('[WP Logbook] ' . $message);
error_log('[Logbook] ' . $message);
}
}
}
@@ -169,17 +169,17 @@ if (defined('WP_NOTES_PATH')) {
// Admin Menu
function wp_notes_admin_menu() {
add_menu_page(
'WP Logbook',
'WP Logbook',
'Logbook',
'Logbook',
'manage_options',
'wp-notes',
'wp_notes_page_callback',
'dashicons-admin-generic',
'dashicons-book-alt', // closed book — reinforces the "logbook" identity
3
);
// "My Log" — the main landing submenu. Same slug as the parent
// menu so clicking either WP Logbook or My Log lands on the same
// menu so clicking either Logbook or My Log lands on the same
// central dashboard (the parent's wp_notes_page_callback already
// renders form + active list + completed list).
//
@@ -218,7 +218,7 @@ function wp_notes_admin_menu() {
'wp_notes_import_export_page'
);
// About submenu — the WP Logbook brand is already carried by the
// About submenu — the Logbook brand is already carried by the
// parent menu, so the submenu can be plain-spoken.
add_submenu_page(
'wp-notes',
@@ -291,7 +291,7 @@ function wp_notes_settings_page() {
settings_errors('wp_notes_settings');
?>
<div class="wrap">
<h1>WP Logbook Settings</h1>
<h1>Logbook Settings</h1>
<form method="post" action="options.php">
<?php
settings_fields('wp_notes_settings');
@@ -313,7 +313,7 @@ function wp_notes_settings_page() {
// Settings section callback
function wp_notes_section_callback() {
echo '<p>Configure default settings for WP Logbook.</p>';
echo '<p>Configure default settings for Logbook.</p>';
}
// Font setting callback
@@ -705,8 +705,8 @@ function wp_notes_ajax_submit_feedback() {
];
$topics_pretty = array_map(function ($t) use ($topic_labels) { return $topic_labels[$t] ?? $t; }, $topics);
$subject = sprintf('[%s] WP Logbook feedback from %s', $site, $user->display_name ?: $user->user_login);
$body = "Feedback received via WP Logbook → About page\n";
$subject = sprintf('[%s] Logbook feedback from %s', $site, $user->display_name ?: $user->user_login);
$body = "Feedback received via Logbook → About page\n";
$body .= str_repeat('-', 48) . "\n\n";
$body .= 'From: ' . ($user->display_name ?: $user->user_login) . ' <' . $user->user_email . ">\n";
$body .= 'Site: ' . home_url() . "\n";
@@ -820,7 +820,7 @@ function wp_notes_save_edit() {
}
/**
* Main WP Logbook page — central hub for note management
* Main Logbook page — central hub for note management
*/
function wp_notes_page_callback() {
if (!current_user_can('edit_posts')) {
@@ -832,6 +832,14 @@ function wp_notes_page_callback() {
$total_notes = count($notes);
$total_done = count($done_notes);
// v3.4.0 — which tab is selected? Default 'active'. Whitelist-only.
$current_tab = isset($_GET['tab']) ? sanitize_key(wp_unslash($_GET['tab'])) : 'active';
if (!in_array($current_tab, array('active', 'completed'), true)) {
$current_tab = 'active';
}
$active_tab_url = esc_url(add_query_arg(array('page' => 'wp-notes', 'tab' => 'active'), admin_url('admin.php')));
$completed_tab_url = esc_url(add_query_arg(array('page' => 'wp-notes', 'tab' => 'completed'), admin_url('admin.php')));
// Get user settings
$settings = get_option('wp_notes_settings', array(
'default_font' => 'Arial',
@@ -840,7 +848,7 @@ function wp_notes_page_callback() {
?>
<div class="wrap">
<!-- Header Section with WordPress Admin Styling -->
<h1 class="wp-heading-inline">WP Logbook</h1>
<h1 class="wp-heading-inline">Logbook</h1>
<span class="page-title-action">v<?php echo esc_html(WP_NOTES_VERSION); ?></span>
<hr class="wp-header-end">
@@ -1005,15 +1013,36 @@ function wp_notes_page_callback() {
<!-- Notes List -->
<h2>Log entries</h2>
<!-- Active Notes List -->
<div class="wp-notes-active" id="active-notes">
<?php wp_notes_display_notes('active'); ?>
</div>
<!-- Completed Notes List -->
<div class="wp-notes-completed" id="completed-notes">
<?php wp_notes_display_notes('completed'); ?>
</div>
<!-- v3.4.0 — WP-native subsubsub tab strip. Single-pane: only the
selected tab's section is rendered below. URL-driven state
(?tab=active|completed) so it's bookmarkable + refresh-stable.
WP-admin core supplies .subsubsub and .current styling. -->
<ul class="subsubsub">
<li>
<a href="<?php echo $active_tab_url; ?>"<?php echo $current_tab === 'active' ? ' class="current"' : ''; ?>>
<?php esc_html_e('Active', 'a-wp-notes'); ?>
<span class="count">(<?php echo (int) $total_notes; ?>)</span>
</a> |
</li>
<li>
<a href="<?php echo $completed_tab_url; ?>"<?php echo $current_tab === 'completed' ? ' class="current"' : ''; ?>>
<?php esc_html_e('Completed', 'a-wp-notes'); ?>
<span class="count">(<?php echo (int) $total_done; ?>)</span>
</a>
</li>
</ul>
<div style="clear:both;"></div>
<?php if ($current_tab === 'active') : ?>
<div class="wp-notes-active" id="active-notes">
<?php wp_notes_display_notes('active'); ?>
</div>
<?php else : ?>
<div class="wp-notes-completed" id="completed-notes">
<?php wp_notes_display_notes('completed'); ?>
</div>
<?php endif; ?>
<!-- Footer: support link (lives at the BOTTOM, not the top) -->
<p class="wp-notes-footer-support">
@@ -1307,25 +1336,44 @@ function wp_notes_handle_actions() {
exit;
}
// Handle restore note action
if (isset($_POST['restore_note']) && isset($_POST['done_ids'])) {
// Handle restore note action (per-row form on the Completed tab).
//
// v3.4.2 fix: this handler used to expect $_POST['done_ids'] — an
// array of IDs from bulk-action checkboxes that were removed in
// v3.1.0. The per-row Restore form in inc/wp-notes-display.php
// sends a hidden $_POST['note_id'] (singular) instead, so the old
// handler's isset($_POST['done_ids']) check was always false and
// the handler body never executed. Clicking Restore therefore
// looked like it did nothing — David's "the complete log does not
// return to active." The v3.4.1 redirect added below was correct
// but never reached because the handler was already dead code.
//
// Rewritten to match the working mark-done single-note handler
// pattern: expect note_id (singular), absint() it, isset() lookup
// in $done_notes, move with the restored_by annotation, then
// redirect to the Active tab where the restored note now lives.
if (isset($_POST['restore_note']) && isset($_POST['note_id'])) {
$notes = get_option('wp_notes', array());
$done_notes = get_option('wp_done_notes', array());
$note_id = absint($_POST['note_id']);
$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');
$note['restored_by'] = $current_user->display_name;
$notes[] = $note;
} else {
$new_done_notes[] = $note;
}
if (isset($done_notes[$note_id])) {
$note = $done_notes[$note_id];
$note['last_modified'] = current_time('mysql');
$note['restored_by'] = $current_user->display_name;
$notes[] = $note;
unset($done_notes[$note_id]);
update_option('wp_notes', $notes);
update_option('wp_done_notes', $done_notes);
// Redirect to the Active tab — without this, the page falls
// through and re-renders with the URL's current ?tab=completed,
// so the restored note (now on Active) would be invisible.
wp_redirect(admin_url('admin.php?page=wp-notes'));
exit;
}
update_option('wp_notes', $notes);
update_option('wp_done_notes', $new_done_notes);
}
// Handle edit note action
@@ -1396,7 +1444,7 @@ function wp_notes_dashboard_widget() {
function wp_notes_add_dashboard_widgets() {
wp_add_dashboard_widget(
'wp_notes_dashboard_widget',
'WP Logbook',
'Logbook',
'wp_notes_dashboard_widget'
);
}
@@ -1407,7 +1455,7 @@ function wp_notes_register_cpt() {
$labels = array(
'name' => __('Notes', 'a-wp-notes'),
'singular_name' => __('Note', 'a-wp-notes'),
'menu_name' => __('WP Logbook', 'a-wp-notes'),
'menu_name' => __('Logbook', 'a-wp-notes'),
'add_new' => __('Add New', 'a-wp-notes'),
'add_new_item' => __('Add New Note', 'a-wp-notes'),
'edit_item' => __('Edit Note', 'a-wp-notes'),
@@ -1640,7 +1688,7 @@ function wp_notes_migration_notice() {
?>
<div class="notice notice-info is-dismissible">
<p>
<?php _e('WP Logbook needs to migrate your existing notes to the new storage system.', 'a-wp-notes'); ?>
<?php _e('Logbook needs to migrate your existing notes to the new storage system.', 'a-wp-notes'); ?>
<a href="<?php echo esc_url(admin_url('admin.php?page=wp-notes-settings&action=migrate')); ?>" class="button button-primary">
<?php _e('Start Migration', 'a-wp-notes'); ?>
</a>