*Completely* Disabling Frontend Customer Registration
-
09-12-2020 - |
Question
So I have read a few threads which all go into detail of removing the create account login button, hiding the content, and even creating a mini extension to remove such activity (http://importantmagento.blogspot.com/2012/06/how-to-disable-user-registration-in_22.html)
I have done all of these, however still adding customer/account/create/
to the end of the webstore still persists with a create account page. Any ideas what I can do here? I have a webstore in which we manually create each account, however it appears someone has found the loophole and persists in creating an account. Thanks!
Solution
You can simply use event controller_action_predispatch_customer_account_create
to disable registration.
Register the event-observer
<events>
<controller_action_predispatch_customer_account_create>
<observers>
<magepsycho_customer_controller_action_predispatch>
<type>singleton</type>
<class>magepsycho_customer/observer</class>
<method>controllerActionPredispatchCustomerAccountCreate</method>
</magepsycho_customer_controller_action_predispatch>
</observers>
</controller_action_predispatch_customer_account_create>
</events>
Implement the Observer Model
<?php
/**
* @category MagePsycho
* @package MagePsycho_Customer
* @author magepsycho@gmail.com
* @website http://www.magepsycho.com
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
class MagePsycho_Customer_Model_Observer
{
public function controllerActionPredispatchCustomerAccountCreate(Varien_Event_Observer $observer)
{
Mage::app()->getResponse()->setRedirect(Mage::getUrl('customer/account/login'))->sendResponse();
exit();
}
}
That's all. Don't forget to remove Register links from wherever it's visible :)