forked from deved-it/magento2-disable-customer-registration
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1af626a
Showing
7 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/** | ||
* Copyright (c) 2016 Salvatore Guarino. All rights reserved. | ||
*/ | ||
|
||
namespace Deved\DisableRegistration\Plugin; | ||
|
||
use Magento\Customer\Model\Registration; | ||
|
||
class RegistrationPlugin | ||
{ | ||
/** | ||
* @var \Magento\Framework\App\Config\ScopeConfigInterface | ||
*/ | ||
protected $scopeConfig; | ||
const XML_PATH_DISABLE_CUSTOMER_REGISTRATION = 'customer/create_account/disable_customer_registration'; | ||
|
||
public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig) | ||
{ | ||
$this->scopeConfig = $scopeConfig; | ||
} | ||
|
||
public function afterIsAllowed(Registration $subject) | ||
{ | ||
$storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORE; | ||
|
||
if ($this->scopeConfig->getValue(self::XML_PATH_DISABLE_CUSTOMER_REGISTRATION, $storeScope)) | ||
{ | ||
return false; | ||
} | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## Magento 2 disable customer registration | ||
This extension allows you to disable the customer registration in your Magento store. | ||
It can be very useful in cases where Admin wants to create account for customers (B2B) and do not want to show the | ||
default Registration form & link on his Magento store | ||
|
||
## Installation | ||
Shortly available |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "deved/magento2-disable-customer-registration", | ||
"description": "Disable Customer registration", | ||
"type": "magento2-module", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Salvatore Guarino", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": "~5.5.0|~5.6.0|~7.0.0", | ||
"magento/framework": "~100.0", | ||
"magento/module-customer": "~100.0" | ||
}, | ||
"autoload": { | ||
"files": [ "registration.php" ], | ||
"psr-4": { | ||
"Deved\\DisableRegistration\\": "" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
~ Copyright (c) 2016 Salvatore Guarino. All rights reserved. | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> | ||
<system> | ||
<section id="customer"> | ||
<group id="create_account"> | ||
<field id="disable_customer_registration" translate="label comment" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1"> | ||
<label>Disable frontend customer registration</label> | ||
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model> | ||
</field> | ||
</group> | ||
</section> | ||
</system> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0"?> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> | ||
<type name="Magento\Customer\Model\Registration"> | ||
<plugin name="Deved_DisableRegistration::after" type="Deved\DisableRegistration\Plugin\RegistrationPlugin"/> | ||
</type> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0"?> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> | ||
<module name="Deved_DisableRegistration" setup_version="2.0.0"> | ||
<sequence> | ||
<module name="Magento_Customer"/> | ||
</sequence> | ||
</module> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
\Magento\Framework\Component\ComponentRegistrar::register( | ||
\Magento\Framework\Component\ComponentRegistrar::MODULE, | ||
'Deved_DisableRegistration', | ||
__DIR__ | ||
); |