cancel
Showing results for 
Search instead for 
Did you mean: 

Disable Customer Registration

SOLVED

Disable Customer Registration

Hello,

 

I am wanting to disable customer registration within a store view so new accounts have to be created by an administrator.

 

I would only want this to affect a specific website for example https://praesepe.kellyseye.com/ not the Default Category of https://store.kellyseye.com/

 

How would I achieve this?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Disable Customer Registration

Hello jordan_cardwell

Sorry, Previous answer for the M2. 

<events>
    <customer_registration_is_allowed>
        <observers>
            <your_module_set_is_active>
                <class>Your_Module_Model_Observers_Customer</class>
                <method>disableCustomerRegistration</method>
            </your_module_set_is_active>
        </observers>
    </customer_registration_is_allowed>
</events>

 

class Your_Module_Model_Observers_Customer
{
    /**
     * Force disable customer registration
     *
     * @param  Varien_Event_Observer $observer Observer
     * @return void
     */
    public function disableCustomerRegistration($observer)
    {
        $result = $observer->getResult();

        if ($result->getIsAllowed() === true) {
            $result->setIsAllowed(false);
        }
    }
}


 In if condition, you can use current store and website Id for disable customer regsitration process for particular store and website.

Hope it will help you then please mark as solution.

View solution in original post

5 REPLIES 5

Re: Disable Customer Registration

Hello  jordan_cardwell

Kindly find below code for disable customer Registration as per store view code or you can get website Id or code.

etc/frontend/di.xml

 

 

<?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\Customer\Model\Registration\DisableRegistrationPlugin"/>
    </type>
</config>

 

Plugin/Customer/Model/Registration/DisableRegistrationPlugin.php

 

 

 

<?php
/**
 * Copyright (c) 2016 Salvatore Guarino. All rights reserved.
 */
namespace Deved\DisableRegistration\Plugin\Customer\Model\Registration;
use Magento\Customer\Model\Registration;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\ScopeInterface;

class DisableRegistrationPlugin
{
    /**
     * @var ScopeConfigInterface
     */
    protected $_storeManager;    
    protected $scopeConfig;
    const XML_PATH_DISABLE_CUSTOMER_REGISTRATION = 'customer/create_account/disable_customer_registration';
    
    public function __construct(
    	ScopeConfigInterface $scopeConfig,
    	        \Magento\Store\Model\StoreManagerInterface $storeManager,        
    )
    {
    $this->_storeManager = $storeManager;        
        $this->scopeConfig = $scopeConfig;
    }
    /**
     * If Registration is not allowed by the plugin - returns false, otherwise returns original value.
     *
     * @param Registration $subject
     * @param bool $result
     * @return bool
     */
    public function afterIsAllowed(Registration $subject, $result)
    {
        if( $this->_storeManager->getStore()->getCode() == "de"){
			return false;
        }
       		return true;
    }
}

Please find extension list
Url: https://marketplace.magento.com/medma-module-disableregistration.html
Url: https://github.com/deved-it/magento2-disable-customer-registration

hope it will help you, if works then mark as solution.

Re: Disable Customer Registration

Hi,

 

Thanks for your reply - However, I am using Magento version 1.9.2.2

 

Some of the paths you have specified don't exist in this version.

Re: Disable Customer Registration

Hello jordan_cardwell

Sorry, Previous answer for the M2. 

<events>
    <customer_registration_is_allowed>
        <observers>
            <your_module_set_is_active>
                <class>Your_Module_Model_Observers_Customer</class>
                <method>disableCustomerRegistration</method>
            </your_module_set_is_active>
        </observers>
    </customer_registration_is_allowed>
</events>

 

class Your_Module_Model_Observers_Customer
{
    /**
     * Force disable customer registration
     *
     * @param  Varien_Event_Observer $observer Observer
     * @return void
     */
    public function disableCustomerRegistration($observer)
    {
        $result = $observer->getResult();

        if ($result->getIsAllowed() === true) {
            $result->setIsAllowed(false);
        }
    }
}


 In if condition, you can use current store and website Id for disable customer regsitration process for particular store and website.

Hope it will help you then please mark as solution.

Re: Disable Customer Registration

Thank you,

 

I am new to Magento and I am struggling to understand where I would insert this code.

 

I have also tried to use the method shown here:

https://stackoverflow.com/questions/2959131/how-to-disable-frontend-registration-in-magento

 

However,

I am trying to access the file at this path: frontend/rwd/kellyseye/template/persistent/customer/form/login.phtml

 

But, within my FTP I can't find this folder structure.

 

Please Help?!

Re: Disable Customer Registration

You can use Disable Customer developed by "STee" to easily deactivate a customer access on the frontend website, and of-course you can always reactivate them. Once deactivated, no data will be erased from the customer account.