CMS Modes Guide
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
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
- 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
🔧 Available Modes
1. Full Featured Mode (Default)
Best for: Self-hosted installations, development environments
Permissions:
- ✅ Plugin management (install, activate, deactivate, delete)
- ✅ Plugin store access
- ✅ All admin features
- ✅ Complete control over the CMS
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:
- ✅ Plugin management (activate, deactivate existing plugins)
- ❌ Plugin store access
- ❌ Plugin installation
- ❌ Plugin deletion
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:
- ❌ Plugin management
- ❌ Plugin store access
- ❌ Plugin installation
- ❌ Plugin activation/deactivation
- ❌ Plugin deletion
Use Case: When you want to pre-install and activate specific plugins with no user modification allowed.
🔄 Changing Modes
Through the Admin Interface
-
Log into the Admin Panel
http://your-site.com/admin
-
Navigate to CMS Mode
- Click on "CMS Mode" in the admin navigation menu
- This will take you to the CMS Mode management page
-
Select Your Desired Mode
- You'll see three cards representing each mode
- Each card shows the mode name, description, and current status
- The current mode will be highlighted in blue
-
Change the Mode
- Click the radio button next to your desired mode
- Click the "Change Mode" button
- Confirm the change when prompted
-
Verify the Change
- The page will refresh and show the new mode
- Check that the permissions have updated correctly
Programmatic Mode Changes
You can also change modes programmatically:
// 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
:
{
"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
# Default configuration - no changes needed
# Users have complete control over their installation
For Hosting Services
Step 1: Install and configure desired plugins
# Install plugins you want to offer
# Configure them appropriately
# Test functionality
Step 2: Choose appropriate mode
Option A: Allow plugin management
# Set mode to "hosting-service-plugins"
# Users can activate/deactivate pre-installed plugins
# No access to store or installation
Option B: No plugin management
# Set mode to "hosting-service-no-plugins"
# Users cannot modify plugins at all
# Maximum security and stability
For Development Environments
Recommended Mode: Full Featured
# Keep full access for development and testing
# Switch to restricted modes only for production
⚙️ Configuration
Checking Current Mode
$cmsModeManager = new CMSModeManager();
echo "Current Mode: " . $cmsModeManager->getCurrentMode();
echo "Mode Name: " . $cmsModeManager->getModeName();
echo "Mode Description: " . $cmsModeManager->getModeDescription();
Checking Permissions
$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
$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
$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
$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
// 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
require_once 'includes/config.php';
require_once 'includes/CMSModeManager.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
- Mode changes require admin authentication
- Changes take effect immediately
- All operations respect the current mode
Plugin Security
- In restricted modes, users cannot install potentially harmful plugins
- Pre-installed plugins are controlled by the hosting provider
- Plugin deletion is prevented in appropriate modes
Store Security
- Store access can be completely disabled
- No external plugin sources in restricted modes
- Controlled plugin ecosystem
🎯 Ad Area System Integration
Conditional Advertising
The CMS mode system integrates with the Ad Area System to provide conditional advertising:
- Full Featured Mode: No advertising displayed (clean experience)
- Hosting Service Modes: Professional ad area visible to showcase hosting services
Template Variables
When in hosting service modes, templates automatically receive these variables:
$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:
{{include=ad-area.html}}
The ad area uses conditional logic to only display when appropriate:
{{#if isHostingServiceMode}}
<div class="ad-area">
<!-- Hosting service advertising content -->
</div>
{{/if}}
Benefits
- Professional Appearance: Hosting providers can showcase their services
- User Experience: Self-hosted users enjoy an ad-free experience
- Easy Management: Single configuration controls ad visibility across all themes
- Consistent Branding: Same ad appearance across all themes
For detailed information about the Ad Area System, see the Ad Area System Guide.
📚 Related Documentation
- Admin Panel Guide - General admin functionality
- Plugin Development Guide - Creating plugins
- Theme Development Guide - Creating themes
- Configuration Guide - System configuration
- Ad Area System - Conditional advertising features
🆘 Getting Help
If you encounter issues with CMS modes:
- Check the troubleshooting section above
- Verify your current mode using the debug script
- Review the permissions for your desired mode
- Check the configuration file for syntax errors
- Ask the community for additional support
Happy mode management! 🎛️
This documentation is maintained by the FearlessCMS community. Last updated: January 2024