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.
Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/kjsebastiaan/block-permission-manager/archive/refs/heads/main.zipA 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
- Download the plugin files
- Upload to
/wp-content/plugins/block-permissions-manager/ - Activate the plugin through the WordPress admin
- Navigate to Block Permissions in the admin menu
🎯 Quick Start
Basic Setup
- Go to Block Permissions → Main Settings
- Select a user role tab (Editor, Author, Contributor, etc.)
- Check the blocks you want that role to access
- Click Save Permissions
Bulk Management
- Enable Bulk Management Mode
- Select multiple roles using checkboxes
- Configure your desired block selection
- Click Apply Current Selection to Selected Roles
Quick Presets
- Go to Block Permissions → Quick Presets
- Choose a preset (Basic, Standard, or Minimal)
- Select target roles
- Click Apply Preset
🏗 Architecture
Class Structure
BPM_Core- Main plugin initialization and coordinationBPM_Admin- Admin interface and menu managementBPM_AJAX- All AJAX request handlers with enhanced securityBPM_Permissions- Block filtering logic and permission managementBPM_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
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📝 License
This project is licensed under the GPL v2 or later.
🆘 Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
🏆 Credits
Developed by Kwaaijongens Enhanced with architectural improvements and performance optimizations.
Made with ❤️ for the WordPress community