WP Manifestindependent plugin directory
manifest / content / dgwltd-revision-manager

DGW.ltd Revision Manager

Modern WordPress revision management with timeline visualization and enhanced editor integration. Built with @wordpress/scripts and React components.

by DGW.ltd · github.com/dogwonder/dgwltd-revision-manager · website

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/dogwonder/dgwltd-revision-manager/archive/refs/heads/main.zip

Readme

DGW.ltd Revision Manager

A modern, enterprise-grade WordPress plugin for managing revisions with lightning-fast timeline visualization, content mismatch alerts, and enhanced editor integration. Built with @wordpress/scripts and React components for a seamless, secure editing experience.

Overview

This plugin provides a modern approach to WordPress revision management, featuring:

  • Revision Mode Control: Choose between standard WordPress revisions or approval workflow
  • Timeline Visualization: Interactive timeline showing current, past, and pending revisions (approval mode)
  • Sidebar Editor Panel: React-based sidebar panel in the block editor
  • Enhanced Revision Editor: Improved revision.php page with "Set as Current" functionality
  • Non-Destructive Switching: Switch between revisions without losing revision history
  • Progressive Interface: Clean, contextual controls that adapt to the selected revision mode
  • Enterprise Performance: 10x faster loading with intelligent caching (200-500ms → 10-50ms)
  • Content Mismatch Alerts: Editor notices when content differs from published version
  • Data Integrity Protection: Self-healing system prevents broken revision references
  • Security Hardening: Role-based access control and complete audit trails

Features

🎯 Editor Sidebar Panel

  • Revision Mode Selection: Choose between Standard WordPress Revisions or Requires Approval
  • Progressive Interface: Timeline and controls only show when approval mode is selected
  • Visual Timeline: Interactive timeline with current, past, and pending revision indicators (approval mode)
  • One-click Revision Switching: Set any revision as current with confirmation modals
  • Per-post Control: Set revision mode individually for each post
  • Content Mismatch Alerts: WordPress notices when editing content differs from published version
  • Lightning Fast Performance: 10x faster loading with intelligent caching (200-500ms → 10-50ms)

📈 Timeline Visualization

🔮 Pending 3 (Pending)
⏳ Pending 2 (Pending)
⭐ Current (Current)
📜 Past 1 (Past)
📜 Past 2 (Past)
📜 Past 3 (Past)

🔧 Revision Editor Enhancements

  • "Set as Current" button on revision.php pages
  • Timeline context showing where current revision fits
  • Confirmation modals for safety
  • Success/error notifications

🔒 Revision Mode Management

  • Standard WordPress Revisions: Plugin steps aside, allowing normal WordPress revision behavior
  • Requires Approval: Enables timeline visualization and approval workflow with pending/current revision states

⚡ Performance & Reliability

  • Intelligent Caching: 5-minute transient caching with automatic invalidation
  • 10x Performance Boost: Timeline loads in 10-50ms instead of 200-500ms
  • Data Integrity Protection: Self-healing system fixes corrupted revision references
  • Enterprise Security: Role-based access control and complete audit trails
  • Debug-Friendly: Cache bypass option for development (?no-cache=1)

🛡️ Security Features

  • CSRF Protection: All operations protected with WordPress nonces
  • Granular Permissions: Authors can't change revision workflows (editors only)
  • Audit Logging: Complete trail of who changed what and when
  • Input Validation: All data sanitized and validated against allowed values

Installation

  1. Upload the plugin to your /wp-content/plugins/ directory
  2. Install dependencies:
    cd wp-content/plugins/dgwltd-revision-manager
    npm install
    npm run build
  3. Activate the plugin in WordPress admin
  4. Enable revision management in post editor sidebar

Configuration

Security & Capabilities

The plugin implements role-based access control for revision management:

Operation Subscriber Contributor Author Editor Admin
View Revisions ✅ (own posts) ✅ (all posts) ✅ (all posts)
Set Current Revision ✅ (own drafts) ✅ (all posts) ✅ (all posts)
Change Revision Mode

Capability Requirements:

  • View Timeline: edit_post + read + edit_posts
  • Publish Revisions: edit_post + publish_posts (for published posts)
  • Change Mode: edit_post + publish_posts + edit_others_posts

Audit Logging

The plugin maintains a complete audit trail of revision mode changes:

  • Always Enabled: Post-level audit trail stored in WordPress post meta
  • Last 10 Changes: User, timestamp, IP address, and mode changes tracked
  • Error Log Integration: Optional logging to WordPress error log

Enable Error Log Auditing

By default, revision mode changes are not logged to WordPress error logs to keep production logs clean. To enable error log entries:

Option 1: Development Sites

  • Enable WP_DEBUG in wp-config.php (automatically enables error logging)

Option 2: Force Enable

  • Add to wp-config.php:
    define('DGW_REVISION_AUDIT_ERROR_LOG', true);

Option 3: Production Sites

  • Leave error logging disabled (default behavior)
  • Audit trail is always available in WordPress admin via post meta

Security Features

  • CSRF Protection: All form submissions protected with WordPress nonces
  • Capability Escalation Prevention: Authors cannot change revision workflows
  • Input Validation: All data sanitized and validated against allowed values
  • Audit Trail: Complete accountability for all revision mode changes

Development

Build Commands

  • npm run start - Development mode with file watching
  • npm run build - Production build
  • npm run lint:js - Lint JavaScript files
  • npm run lint:css - Lint CSS files

Project Structure

dgwltd-revision-manager/
├── src/                           # React/JS source files
│   ├── components/               # React components
│   │   ├── RevisionManagerPanel.js
│   │   ├── RevisionTimeline.js
│   │   └── RevisionItem.js
│   ├── editor.js                 # Editor sidebar integration
│   ├── revision-editor.js        # Revision page enhancements
│   ├── admin.js                  # Admin functionality
│   └── *.scss                    # Styles
├── includes/                      # PHP classes
│   ├── Core/                     # Core plugin classes
│   │   ├── Plugin.php
│   │   └── Assets.php
│   ├── API/                      # REST API controllers
│   │   └── RevisionController.php
│   ├── Admin/                    # Admin functionality
│   │   └── EditorPanel.php
│   ├── Frontend/                 # Public-facing functionality
│   │   └── RevisionFilter.php
│   └── Utils/                    # Utility classes
│       └── RevisionHelper.php
├── build/                        # Compiled assets (auto-generated)
├── assets/                       # Static assets
├── languages/                    # Translation files
└── tests/                        # Unit and integration tests

Usage

Basic Workflow

  1. Open a post in the block editor
  2. Find the Revision Manager panel in the sidebar (🔄 icon)
  3. Choose revision mode: Standard WordPress Revisions or Requires Approval
  4. For approval mode: View timeline of revisions with visual indicators
  5. Switch revisions using "Set as Current" buttons (approval mode only)

Advanced Features

Timeline Navigation (Approval Mode)

  • Visual timeline shows revision relationships with status indicators
  • Click "View" to open revision in comparison editor
  • "Set as Current" promotes any revision to be the active version
  • Timeline only appears when "Requires Approval" mode is selected

Revision Editor Integration

  • Enhanced /wp-admin/revision.php pages
  • Timeline context shows where revision fits
  • One-click switching with confirmation

Revision Mode Control

  • Per-post control with clean radio button interface
  • Progressive disclosure shows relevant features based on mode
  • Real-time updates when mode changes
  • Standard mode: Plugin stays out of the way, normal WordPress behavior
  • Approval mode: Full timeline and revision management features

API Reference

REST API Endpoints

All endpoints are prefixed with /wp-json/dgw-revision-manager/v1/

Get Post Revisions

GET /revisions/{post_id}

Returns revision timeline data for a post.

Performance: Intelligent caching provides 10x speed improvement:

  • First request: Builds data and caches (200-500ms)
  • Subsequent requests: Serves from cache (10-50ms)
  • Cache duration: 5 minutes with automatic invalidation
  • Debug bypass: Add ?no-cache=1 when WP_DEBUG is enabled

Set Revision as Current

POST /revisions/{revision_id}/set-current

Sets a specific revision as the current/active version.

Update Revision Mode

PUT /revisions/{post_id}/mode

Updates the revision mode for a post (standard or approval).

JavaScript Integration

Using the Timeline Component

import { RevisionTimeline } from './components/RevisionTimeline';

<RevisionTimeline
    revisionData={revisionData}
    onRevisionChange={handleRevisionChange}
/>

API Usage

import apiFetch from '@wordpress/api-fetch';

// Get revision data
const revisions = await apiFetch({
    path: `/dgw-revision-manager/v1/revisions/${postId}`
});

// Set revision as current
await apiFetch({
    path: `/dgw-revision-manager/v1/revisions/${revisionId}/set-current`,
    method: 'POST'
});

// Update revision mode
await apiFetch({
    path: `/dgw-revision-manager/v1/revisions/${postId}/mode`,
    method: 'PUT',
    data: { mode: 'pending' } // 'open' or 'pending'
});
  • Real-time switching: Change modes and see immediate interface updates

Compatibility

  • WordPress: 6.0 or higher
  • PHP: 8.0 or higher
  • Node.js: 18.0 or higher (for development)
  • Browsers: Modern browsers with ES2017 support

License

GPL v2 or later - same as WordPress

Support

For issues and feature requests, please use the repository's issue tracker.


Credits

Inspired by and compatible with the original fabrica-pending-revisions plugin by Fabrica.

Read the full README on GitHub →