buten/module-guest-restriction
最新稳定版本:1.0.0
Composer 安装命令:
composer require buten/module-guest-restriction
包简介
Magento 2 module that restricts access or visibility for guest users.
README 文档
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.
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-30