WP Manifestindependent plugin directory
manifest / content / product-documentation-system

Product Documentation System

WordPress plugin for product documentation with versioning and access control

by Ayush Meher · github.com/ayush-meher/product-documentation-system · 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/ayush-meher/product-documentation-system/archive/refs/heads/main.zip

Requires: WordPress 6.0+, PHP 7.4+
License: GPL v2 or later

A professional WordPress plugin for managing versioned product documentation with granular user access control and analytics.


Features

Core Functionality

Product Management

  • Create multiple products, each with its own documentation library
  • Each product can have unlimited versions (1.0, 1.1, 2.0, etc.)
  • Versions are product-specific, preventing confusion between different products

Documentation System

  • Create documentation pages assigned to specific products and versions
  • Clean, SEO-friendly URLs: /docs/product-name/version/documentation-title/
  • Professional templates with breadcrumb navigation and version badges
  • Automatic URL generation based on product, version, and title

User Access Control

  • Assign specific users to specific products
  • Administrators automatically have access to all documentation
  • Non-logged-in users are redirected to login
  • Users without access see a professional "Access Denied" page
  • Server-side security ensures access rules cannot be bypassed

Analytics Dashboard

  • Track documentation views per page and per product
  • Identify most popular documentation
  • Monitor which versions are being used
  • View recent activity and engagement metrics
  • Dashboard widget shows key statistics at a glance

Admin Tools

  • Overview page shows all products, versions, users, and documentation in one place
  • Quick edit and add documentation buttons
  • Debug tools for troubleshooting
  • One-click sample data installation for testing

How to Install, Activate and Use the Plugin

Installation

Step 1: Upload the Plugin

  1. Download the plugin ZIP file
  2. Log in to your WordPress admin panel
  3. Navigate to Plugins > Add New
  4. Click "Upload Plugin"
  5. Choose the ZIP file and click "Install Now"
  6. Click "Activate Plugin"

Step 2: Configure Permalinks

This step is required for the custom URL structure to work:

  1. Go to Settings > Permalinks
  2. Click "Save Changes" (you don't need to change any settings)
  3. This refreshes WordPress rewrite rules

Step 3: Install Sample Data (Optional but Recommended)

To see how the plugin works with example content:

  1. Go to Products > Debug Info
  2. Click the "Install Sample Data" button
  3. This creates 3 sample products with documentation

Basic Usage

Creating Your First Product

  1. Go to Products > Add New
  2. Enter a product name (e.g., "Analytics Platform")
  3. Add a description in the content editor
  4. Click "Publish"

Adding Versions to a Product

  1. Edit your product
  2. Scroll to the "Version Management" box
  3. Click "+ Add Version"
  4. Enter a version number (e.g., "1.0")
  5. Add more versions as needed
  6. Click "Update"

Assigning User Access

  1. Edit your product
  2. Scroll to the "User Access Control" box
  3. Check the boxes next to users who should access this product
  4. Click "Update"

Note: Administrators always have access to all products.

Creating Documentation

  1. Go to Documentation > Add New
  2. Enter a title (e.g., "Getting Started Guide")
  3. Write your documentation content
  4. In the right sidebar, select:
    • Product: Choose your product
    • Version: Choose a version (only versions from selected product will appear)
  5. Click "Publish"

Viewing Documentation

After publishing, you'll see the documentation URL in the sidebar. It will look like: https://yoursite.com/docs/analytics-platform/1-0/getting-started-guide/

You can also find documentation URLs in Products > Overview.

Managing Multiple Versions

To document different versions of the same product:

  1. Create documentation for version 1.0
  2. Create separate documentation for version 2.0
  3. Each version can have completely different content

Users can access documentation specific to the version they're using.

Using the Overview Page

Go to Products > Overview to see:

  • All products with their assigned versions
  • Number of documentation pages per product
  • Which users have access to each product
  • View counts for products and documentation
  • Quick links to edit or add documentation

Viewing Analytics

Go to Products > Analytics to see:

  • Total views across all documentation
  • Most viewed documentation pages
  • Performance metrics per product
  • Most popular versions
  • Recent viewing activity

The main WordPress dashboard also shows a widget with summary statistics.


How It Works

URL Structure

The plugin creates a custom URL pattern for documentation:

https://yoursite.com/docs/{product-slug}/{version-slug}/{doc-slug}/

For example:

https://yoursite.com/docs/analytics-platform/1-0/getting-started/
https://yoursite.com/docs/analytics-platform/2-0/api-reference/
https://yoursite.com/docs/email-suite/1-5/setup-guide/

This structure is:

  • Clean and readable
  • SEO-friendly
  • Easy to share
  • Automatically generated

Data Organization

Products

  • Stored as a custom post type called "product"
  • Each product has its own set of versions stored as post metadata
  • Versions are stored as an array (e.g., ['1.0', '1.1', '2.0'])

Documentation

  • Stored as a custom post type called "documentation"
  • Each documentation page stores:
    • Associated product ID
    • Associated version string
    • View count
    • Last viewed timestamp
    • List of unique viewers

User Access

  • Stored in WordPress user metadata
  • Each user has a meta field _pds_accessible_products containing an array of product IDs
  • Access is checked server-side when documentation is requested

Request Flow

When a user visits a documentation URL:

  1. WordPress matches the URL pattern and extracts the product, version, and doc slugs
  2. The plugin finds the product by its slug
  3. The plugin finds the documentation matching the product, version, and doc slug
  4. Access control checks if the user is allowed to view this product
  5. If allowed, the documentation template is loaded
  6. If denied, the user sees an access denied page or login screen
  7. Analytics tracking increments the view count

Access Control Logic

User visits documentation URL
    ↓
Is user an administrator?
    ↓ Yes → Grant access
    ↓ No
Is user logged in?
    ↓ No → Redirect to login
    ↓ Yes
Does user have access to this product?
    ↓ Yes → Show documentation
    ↓ No → Show "Access Denied" page

Analytics Tracking

When documentation is viewed:

  1. View count for the documentation page is incremented
  2. View count for the parent product is incremented
  3. Last viewed timestamp is updated
  4. If the viewer is logged in, their ID is added to the unique viewers list
  5. No personal information or IP addresses are stored

Analytics can be viewed by administrators in:

  • Products > Analytics (full dashboard)
  • WordPress Dashboard (summary widget)
  • Products > Overview (view counts per item)

Version Management

Unlike typical WordPress plugins that use taxonomies for versions, this plugin:

  • Stores versions as metadata on each product
  • Allows each product to have completely independent versions
  • Prevents confusion between "Version 1.0" of different products
  • Provides a dedicated interface for managing versions per product
  • Automatically filters version dropdowns to show only relevant versions

Security Measures

  • All access checks happen server-side and cannot be bypassed
  • Form submissions use WordPress nonces to prevent CSRF attacks
  • User capabilities are verified before saving data
  • All database queries use prepared statements to prevent SQL injection
  • User input is sanitized before storage
  • Output is escaped before display
  • Access denied responses use proper HTTP status codes (403)

Technical Information

Custom Post Types:

  • product - For products
  • documentation - For documentation pages

Meta Fields:

  • _pds_versions (product) - Array of version strings
  • _pds_product_id (documentation) - ID of associated product
  • _pds_product_version (documentation) - Version string
  • _pds_views (documentation, product) - View count
  • _pds_last_viewed (documentation) - Last view timestamp
  • _pds_viewers (documentation) - Array of user IDs who viewed
  • _pds_accessible_products (user) - Array of accessible product IDs

Admin Pages:

  • Products > Overview - Comprehensive view of all data
  • Products > Analytics - Usage statistics and insights
  • Products > Debug Info - Diagnostic tools and sample data installer

Hooks and Filters: The plugin uses standard WordPress hooks for extensibility. Custom templates can be added to your theme by creating:

  • single-documentation.php - For documentation pages
  • access-denied.php - For access denied pages

Support and Documentation

For questions or issues, please refer to:

  • Products > Debug Info for diagnostic tools
  • Sample data (install via Debug Info page) for examples
  • Products > Overview to verify your setup

License

This plugin is licensed under GPL v2 or later.

Copyright (c) 2024 Ayush Meher