CMS Modes Guide
FearlessCMS supports three different operational modes to accommodate various deployment scenarios. This guide explains how to use and configure these modes.
📋 Table of Contents
- Overview
- Available Modes
- Changing Modes
- Use Cases
- Configuration
- Troubleshooting
- Flexible Deployment: Choose the right mode for your hosting scenario
- Security: Restrict access to sensitive operations
- User Experience: Provide appropriate interfaces based on user needs
- Easy Management: Change modes through the admin interface
- ✅ Plugin management (install, activate, deactivate, delete)
- ✅ Plugin store access
- ✅ All admin features
- ✅ Complete control over the CMS
- ✅ Plugin management (activate, deactivate existing plugins)
- ❌ Plugin store access
- ❌ Plugin installation
- ❌ Plugin deletion
- ❌ Plugin management
- ❌ Plugin store access
- ❌ Plugin installation
- ❌ Plugin activation/deactivation
- ❌ Plugin deletion
- Log into the Admin Panel
🎯 Overview
CMS modes allow you to control the level of access users have to plugin management and the plugin store. This is particularly useful for hosting services that want to provide different levels of functionality to their users.
Key Benefits
🔧 Available Modes
1. Full Featured Mode (Default)
Best for: Self-hosted installations, development environments
Permissions:
Use Case: When you want users to have complete control over their CMS installation.
2. Hosting Service (Plugin Mode)
Best for: Hosting services with curated plugin selections
Permissions:
Use Case: When you want to pre-install a curated selection of plugins and allow users to manage them.
3. Hosting Service (No Plugin Management)
Best for: Highly restricted hosting environments
Permissions:
Use Case: When you want to pre-install and activate specific plugins with no user modification allowed.
🔄 Changing Modes
Through the Admin Interface
http://your-site.com/admin
Programmatic Mode Changes
You can also change modes programmatically:
php
// Initialize the CMS mode manager
$cmsModeManager = new CMSModeManager();// Change to hosting service plugin mode
$cmsModeManager->setMode('hosting-service-plugins');
// Change to no plugin management mode
$cmsModeManager->setMode('hosting-service-no-plugins');
// Restore to full featured mode
$cmsModeManager->setMode('full-featured');
Configuration File
The mode is stored in config/cms_mode.json
:
json
{
"mode": "full-featured"
}
You can manually edit this file, but using the admin interface is recommended.
🎯 Use Cases
For Self-Hosted Installations
Recommended Mode: Full Featured
bash
Default configuration - no changes needed
Users have complete control over their installation
For Hosting Services
Step 1: Install and configure desired plugins
bash
Install plugins you want to offer
Configure them appropriately
Test functionality
Step 2: Choose appropriate mode
Option A: Allow plugin management
bash
Set mode to "hosting-service-plugins"
Users can activate/deactivate pre-installed plugins
No access to store or installation
Option B: No plugin management
bash
Set mode to "hosting-service-no-plugins"
Users cannot modify plugins at all
Maximum security and stability
For Development Environments
Recommended Mode: Full Featured
bash
Keep full access for development and testing
Switch to restricted modes only for production
⚙️ Configuration
Checking Current Mode
php
$cmsModeManager = new CMSModeManager();
echo "Current Mode: " . $cmsModeManager->getCurrentMode();
echo "Mode Name: " . $cmsModeManager->getModeName();
echo "Mode Description: " . $cmsModeManager->getModeDescription();
Checking Permissions
php
$cmsModeManager = new CMSModeManager();// Check specific permissions
if ($cmsModeManager->canAccessStore()) {
echo "Store access is allowed";
}
if ($cmsModeManager->canManagePlugins()) {
echo "Plugin management is allowed";
}
if ($cmsModeManager->canActivatePlugins()) {
echo "Plugin activation is allowed";
}
if ($cmsModeManager->canDeactivatePlugins()) {
echo "Plugin deactivation is allowed";
}
if ($cmsModeManager->canInstallPlugins()) {
echo "Plugin installation is allowed";
}
if ($cmsModeManager->canDeletePlugins()) {
echo "Plugin deletion is allowed";
}
Getting All Permissions
php
$cmsModeManager = new CMSModeManager();
$permissions = $cmsModeManager->getPermissionsSummary();foreach ($permissions as $permission => $allowed) {
echo "$permission: " . ($allowed ? 'Yes' : 'No') . "\n";
}
🔍 Troubleshooting
Common Issues
#### Store Not Accessible
Problem: Users can't access the plugin store
Solution: Check the current mode
php
$cmsModeManager = new CMSModeManager();
if (!$cmsModeManager->canAccessStore()) {
echo "Store access is disabled in current mode: " . $cmsModeManager->getCurrentMode();
}
#### Plugin Management Disabled
Problem: Users can't manage plugins
Solution: Verify current mode allows plugin management
php
$cmsModeManager = new CMSModeManager();
if (!$cmsModeManager->canManagePlugins()) {
echo "Plugin management is disabled in current mode: " . $cmsModeManager->getCurrentMode();
}
#### Navigation Items Missing
Problem: Some admin menu items are not visible
Solution: This is expected behavior - items are hidden based on permissions
php
// Check what's available in current mode
$cmsModeManager = new CMSModeManager();
echo "Can access store: " . ($cmsModeManager->canAccessStore() ? 'Yes' : 'No');
echo "Can manage plugins: " . ($cmsModeManager->canManagePlugins() ? 'Yes' : 'No');
Debugging Mode Issues
Create a debug script to check mode status:
php
$cmsModeManager = new CMSModeManager();
echo "=== CMS Mode Debug ===\n";
echo "Current Mode: " . $cmsModeManager->getCurrentMode() . "\n";
echo "Mode Name: " . $cmsModeManager->getModeName() . "\n";
echo "Mode Description: " . $cmsModeManager->getModeDescription() . "\n\n";
echo "Permissions:\n";
echo "- Can Manage Plugins: " . ($cmsModeManager->canManagePlugins() ? 'Yes' : 'No') . "\n";
echo "- Can Access Store: " . ($cmsModeManager->canAccessStore() ? 'Yes' : 'No') . "\n";
echo "- Can Install Plugins: " . ($cmsModeManager->canInstallPlugins() ? 'Yes' : 'No') . "\n";
echo "- Can Activate Plugins: " . ($cmsModeManager->canActivatePlugins() ? 'Yes' : 'No') . "\n";
echo "- Can Deactivate Plugins: " . ($cmsModeManager->canDeactivatePlugins() ? 'Yes' : 'No') . "\n";
echo "- Can Delete Plugins: " . ($cmsModeManager->canDeletePlugins() ? 'Yes' : 'No') . "\n";
?>
Error Messages
| Error | Cause | Solution |
|-------|-------|----------|
| "Store access is disabled" | Current mode doesn't allow store access | Change to full-featured mode or accept the restriction |
| "Plugin management is disabled" | Current mode doesn't allow plugin management | Change to a mode that allows plugin management |
| "Invalid CMS mode" | Configuration file contains invalid mode | Check config/cms_mode.json
and use valid mode name |
🔒 Security Considerations
Mode Changes
Plugin Security
Store Security
🎯 Ad Area System Integration
Conditional Advertising
The CMS mode system integrates with the Ad Area System to provide conditional advertising:Template Variables
When in hosting service modes, templates automatically receive these variables:php
$templateData = [
'cmsMode' => $cmsModeManager->getCurrentMode(),
'isHostingServiceMode' => $cmsModeManager->isRestricted(),
'cmsModeName' => $cmsModeManager->getModeName(),
];
Automatic Integration
All themes automatically include the ad area when in hosting service modes using:html
{{include=ad-area.html}}
The ad area uses conditional logic to only display when appropriate:
html
{{#if isHostingServiceMode}}
{{/if}}
Benefits
For detailed information about the Ad Area System, see the Ad Area System Guide.
📚 Related Documentation
🆘 Getting Help
If you encounter issues with CMS modes:
---
Happy mode management! 🎛️
This documentation is maintained by the FearlessCMS community. Last updated: January 2024