buten / module-guest-restriction
Magento 2 module that restricts access or visibility for guest users.
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:magento2-module
pkg:composer/buten/module-guest-restriction
Requires
- php: >=8.1
- magento/framework: >=103.0.4
- magento/module-customer: >=103.0.4
- magento/module-store: >=101.1.4
This package is not auto-updated.
Last update: 2025-10-30 21:18:39 UTC
README
Buten_GuestRestriction is a lightweight Magento 2 module designed to restrict access and hide specific frontend content for guest (not logged-in) users.
It helps store owners ensure that certain features, blocks, or pages are visible only to authenticated customers - improving user flow and protecting restricted content.
π§© Features
- π« Hide or disable layout blocks for guest users.
- βοΈ Configurable from the Magento Admin panel.
- π§© Compatible with both Magento Open Source and Adobe Commerce.
- π§© Lightweight - no database schema changes or UI components added.
ποΈ Module Structure
Buten/GuestRestriction
βββ etc/
β βββ adminhtml/system.xml # Admin configuration settings
β βββ config.xml # Default configuration values
β βββ frontend/di.xml # Dependency Injection for frontend
β βββ frontend/events.xml # Observers for frontend area
β βββ module.xml # Module declaration
βββ Helper/ConfigHelper.php # Fetch configuration values
βββ Observer/RemoveBlocksObserver.php # Removes restricted blocks for guests
βββ Plugin/RestrictPlugin.php # Plugin logic for restriction
βββ registration.php # Registers the module with Magento
βοΈ Installation
Option 1: Install via Composer (recommended)
If the module is published on Packagist or your VCS repository:
composer require buten/module-guest-restriction bin/magento module:enable Buten_GuestRestriction bin/magento setup:upgrade bin/magento cache:flush
Option 2: Manual installation
- Copy this module to:
app/code/Buten/GuestRestriction - Enable and upgrade:
bin/magento module:enable Buten_GuestRestriction bin/magento setup:upgrade bin/magento cache:flush
π§ Configuration
Navigate to:
Admin Panel β Stores β Settings β Configuration β Buten β Guest Restriction
*Select scope if required.
Available Settings
| Setting | Description |
|---|---|
| Enabled | Turn guest restriction on or off (redirects guests to the login page) |
| Allowed pages | Specify the list of pages allowed for guests |
| Remove blocks | (Optional) Turn blocks removal on or off |
| Blocks to be removed | (Optional) Specify the list of block names to be removed |
π§© Compatibility
| Magento Version | Supported |
|---|---|
| Magento Open Source >= 2.4.4 | β |
| Adobe Commerce >= 2.4.4 | β |
| PHP >= 8.1 | β |
π§© Technical Details
- Area: Frontend only
- Depends on:
Magento_Customer,Magento_Store - Entry Points: Observers & Plugins
- Data Storage: Uses configuration only (no DB tables)
π¨βπ» Developer
Author: Pavlo Butenko
GitHub: https://github.com/pbuten
Email: pavlo.buten@gmail.com
If you find this module useful, please β star the repository!
π License
This module is licensed under the MIT License.
Youβre free to use, modify, and distribute it in commercial or open-source projects as long as you retain the copyright notice.