Files
rangerhq-logbook/inc/admin-bar.php
T
ranger 0c20833fe5 release: 3.1.0 → 3.2.0 — rebrand A-WP-Notes → WP Logbook
The plugin's identity has shifted over the day's work — from a notes
pad to a work-logbook with time tracking, earnings, and a Wallet
tile on the v4 roadmap. "WP Notes" undersold what it had become and
collided semantically with WordPress's notes-as-memos connotation;
"WP Logbook" matches both the freelancer use case ("logbook for
clients") and the student use case ("logbook for teachers"), and
matches the exact word the plugin's own About-page intro had been
using all day.

USER-FACING CHANGES
- Plugin Name header: A-WP-Notes → WP Logbook
- Description header rewritten to reflect the work-logbook framing
- Admin menu top-level: WP Notes → WP Logbook
- Admin sidebar submenu: My Notes → My Log (matches new parent —
  reads cleanly as "WP Logbook → My Log")
- Admin bar count menu: WP Notes (N) → WP Logbook (N)
- Dashboard widget title: WP Notes → WP Logbook
- Settings page H1: WP Notes Settings → WP Logbook Settings
- Main page H1: WP Notes → WP Logbook
- About page: every brand mention updated; "Go to WP Notes →" CTA
  now reads "Go to My Log →" to match the new submenu
- About page version history now leads with v3.2.0 (this release)
  as latest, demotes v3.1.0 to the previous entry
- CPT menu_name label: WP Notes → WP Logbook (cosmetic only — CPT
  hidden from admin UI since the duplicate-form fix in v3.1.0)
- Migration notice text updated
- Email-feedback subject + body intro updated
- Legacy feedback.php subjects (WP Notes Feedback / Help Request)
  → WP Logbook variants
- error_log() prefix [WP Notes] → [WP Logbook]

ZERO-MIGRATION COMMITMENT — these stay unchanged
- All wp_notes_* function names
- All WP_NOTES_* constants
- All DB option keys (wp_notes, wp_done_notes, wp_notes_settings,
  wp_notes_migration_completed, wp_notes_version,
  wp_notes_dismissed_empty_active|completed)
- All user_meta keys
- Admin page slug 'wp-notes' (preserves bookmarks, admin-bar
  #new-note anchor, and the legacy ?page=wp-notes-create redirect)
- Plugin text domain 'a-wp-notes'
- File and directory names (wp-notes.php, inc/wp-notes-*.php,
  assets/wp-notes-banner.jpg)
- Gitea repo name (ranger/a-wp-notes-v3) — David can rename on the
  Gitea side separately if he wants

The rename is purely user-facing strings. Existing installs see the
new name appear after a plugin file refresh, with zero behaviour
change. No re-activation needed.

VERSION BUMP
- wp-notes.php header Version: 3.1.0 → 3.2.0
- WP_NOTES_VERSION constant: 3.1.0 → 3.2.0
- CHANGELOG: new [3.2.0] section that bundles the rename with the
  post-3.1.0 unreleased work (About-page rewrite, feedback form)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 08:28:50 +01:00

112 lines
3.4 KiB
PHP

<?php
// inc/admin-bar.php
if (!defined('ABSPATH')) {
exit;
}
// Add admin bar styles
add_action('admin_head', 'wp_notes_admin_bar_styles');
add_action('wp_head', 'wp_notes_admin_bar_styles');
function wp_notes_admin_bar_styles() {
?>
<style>
#wp-admin-bar-wp-notes .count {
display: inline-block;
padding: 1px 6px;
border-radius: 9px;
background-color: #ca4a1f;
color: #fff;
font-size: 11px;
line-height: 1.6;
margin-left: 5px;
vertical-align: middle;
}
</style>
<?php
}
add_action('wp_admin_bar_menu', 'wp_notes_admin_bar_menu', 10);
/**
* Adds items to the WordPress admin bar.
* Uses standard WordPress capabilities
*/
function wp_notes_admin_bar_menu($wp_admin_bar) {
// Use standard WordPress capabilities
if (current_user_can('edit_posts')) {
// Get note count
$notes = get_option('wp_notes', array());
$count = count($notes);
// Main WP Logbook menu item
$wp_admin_bar->add_node(array(
'id' => 'wp-notes',
'title' => sprintf('WP Logbook <span class="count">%d</span>', $count),
'href' => admin_url('admin.php?page=wp-notes'),
));
// Add New Note submenu
$wp_admin_bar->add_node(array(
'id' => 'wp-notes-new-note',
'title' => 'New Note',
'href' => admin_url('admin.php?page=wp-notes#new-note'),
'parent' => 'wp-notes'
));
}
// Add About submenu
if (current_user_can('manage_options')) {
$wp_admin_bar->add_node(array(
'id' => 'wp-notes-about',
'title' => 'About',
'href' => admin_url('admin.php?page=wp-notes-about'),
'parent' => 'wp-notes'
));
// Add Settings submenu
$wp_admin_bar->add_node(array(
'id' => 'wp-notes-settings',
'title' => 'Settings',
'href' => admin_url('admin.php?page=wp-notes-settings'),
'parent' => 'wp-notes',
));
}
// Add Import/Export submenu (for admins)
if (current_user_can('manage_options')) {
$export_url = add_query_arg('action', 'export', admin_url('admin.php?page=wp-notes'));
$export_nonce_url = wp_nonce_url($export_url, 'wp_notes_export_action', 'wp_notes_export_nonce');
// Add export submenu
$wp_admin_bar->add_node(array(
'id' => 'wp-notes-export',
'title' => 'Export Notes',
'href' => $export_nonce_url,
'parent' => 'wp-notes'
));
// Add import submenu
$wp_admin_bar->add_node(array(
'id' => 'wp-notes-import',
'title' => 'Import Notes',
'href' => add_query_arg('section', 'import', admin_url('admin.php?page=wp-notes')),
'parent' => 'wp-notes'
));
}
// Add update check for admins
if (current_user_can('manage_options')) {
$update_check_url = add_query_arg('check_update', '1', admin_url('admin.php?page=wp-notes'));
$update_check_nonce_url = wp_nonce_url($update_check_url, 'wp_notes_check_update_action', 'wp_notes_check_update_nonce');
$wp_admin_bar->add_node(array(
'id' => 'wp-notes-update',
'title' => 'Check Updates',
'href' => $update_check_nonce_url,
'parent' => 'wp-notes'
));
}
}