WP Manifestindependent plugin directory
manifest / editor / block-permission-manager

KJ Block Permissions Manager

Control which Gutenberg blocks each WordPress user role can access. Features role-based permissions, admin dashboard, quick presets (Basic/Standard/Minimal), GenerateBlocks integration, search & bulk actions. Administrators get full access while other roles are restricted. Perfect for managing content creation capabilities across teams.

by Kwaaijongens · github.com/kjsebastiaan/block-permission-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/kjsebastiaan/block-permission-manager/archive/refs/heads/main.zip

A powerful WordPress plugin for managing Gutenberg block permissions by user role with advanced caching and bulk management features.

🚀 Features

Core Functionality

  • Role-based block permissions - Control which blocks each user role can access
  • Real-time block filtering - Dynamically restrict blocks in the editor
  • GenerateBlocks integration - Hide advanced styling options for non-admin users
  • Administrator override - Admins always have access to all blocks

Performance & Architecture

  • Modular design - Clean, organized codebase with PSR-4 autoloading
  • Advanced caching - Transient-based caching for optimal performance
  • Smart cache invalidation - Automatic cache clearing when permissions change
  • Scalable architecture - Handles large sites with many blocks efficiently

User Experience

  • Bulk role management - Apply permissions to multiple roles at once
  • Copy permissions - Duplicate settings between roles
  • Quick presets - Pre-configured permission sets (Basic, Standard, Minimal)
  • Import/Export - Backup and share configurations
  • Search & filtering - Find blocks quickly with search functionality
  • Visual feedback - Real-time block counts and status indicators

📦 Installation

  1. Download the plugin files
  2. Upload to /wp-content/plugins/block-permissions-manager/
  3. Activate the plugin through the WordPress admin
  4. Navigate to Block Permissions in the admin menu

🎯 Quick Start

Basic Setup

  1. Go to Block PermissionsMain Settings
  2. Select a user role tab (Editor, Author, Contributor, etc.)
  3. Check the blocks you want that role to access
  4. Click Save Permissions

Bulk Management

  1. Enable Bulk Management Mode
  2. Select multiple roles using checkboxes
  3. Configure your desired block selection
  4. Click Apply Current Selection to Selected Roles

Quick Presets

  1. Go to Block PermissionsQuick Presets
  2. Choose a preset (Basic, Standard, or Minimal)
  3. Select target roles
  4. Click Apply Preset

🏗 Architecture

Class Structure

  • BPM_Core - Main plugin initialization and coordination
  • BPM_Admin - Admin interface and menu management
  • BPM_AJAX - All AJAX request handlers with enhanced security
  • BPM_Permissions - Block filtering logic and permission management
  • BPM_Cache - Performance optimization through intelligent caching

Performance Features

  • Block registry caching (24-hour expiration)
  • User permissions caching (1-hour expiration)
  • Automatic cache invalidation on permission updates
  • Optimized database queries with minimal overhead

🔒 Security Features

  • Nonce validation for all AJAX operations
  • Capability checks beyond basic manage_options
  • Input sanitization for all form data
  • Secure file uploads for configuration import
  • XSS prevention with proper output escaping

🛠 Advanced Usage

Developer Hooks

// Filter available presets
add_filter('bpm_available_presets', function($presets) {
    $presets['custom-preset'] = array(
        'name' => 'Custom Preset',
        'description' => 'Custom block selection',
        'blocks' => array('core/paragraph', 'core/heading')
    );
    return $presets;
});

// Modify block permissions programmatically
$permissions = new BPM_Permissions(new BPM_Cache());
$permissions->set_role_permissions('editor', array('core/paragraph', 'core/heading'));

Cache Management

// Clear all caches
$cache = new BPM_Cache();
$cache->clear_all_cache();

// Clear specific user permissions
$cache->clear_user_permission($user_id);

📊 Version History

v1.1.0 (Latest)

  • Complete architecture refactor with modular design
  • Performance optimization with intelligent caching
  • Bulk role management with multi-select capabilities
  • Enhanced security with specific nonces and validation
  • Import/Export functionality for configuration management
  • Copy permissions tool for quick role duplication
  • Responsive design improvements
  • Backward compatibility maintained

v1.0.0

  • Basic block permissions by role
  • Simple admin interface
  • GenerateBlocks integration

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📝 License

This project is licensed under the GPL v2 or later.

🆘 Support

🏆 Credits

Developed by Kwaaijongens Enhanced with architectural improvements and performance optimizations.


Made with ❤️ for the WordPress community