This basic Magento1 module exposes a new admin option and a couple of related methods to disable users (customers) registration on the frontend.
- The module defaults to "allow registrations" (no changes from Magento default behaviour)
- Activate it at default/website/store level via
Admin -> System -> Configuration -> Prevent users registration
- As soon as the module is active,
/customer/account/create/
redirects to/customer/account/login/
- You must manually edit your templates to hide all the links to the registration page: see a worked-for-me list at the bottom
<?php
if( Mage::helper('boraso_preventusersregistration')->allowUsersRegistration() ) { ?>
<a href="/customer/account/create/">REGISTER NOW!</a>
<?php
}//end Registrazione abilitata
?>
These files have at least one link to the registration page. It must be wrapped as shown above.
- /app/design/frontend/custom_package_name/default/template/page/html/header.phtml
- /app/design/frontend/custom_package_name/default/template/persistent/checkout/onepage/login.phtml
- /app/design/frontend/custom_package_name/default/template/persistent/customer/form/login.phtml
- /app/design/frontend/custom_package_name/default/template/customer/form/login.phtml (unused?)
If you want to automatically disable disable users (customers) registration at install-time, package this code as an install/upgrade script:
<?php
/**
* Disabilito registrazione utenti su website EN
* ---------------------------------------------
*
* Questo valore viene letto da Boraso_PreventUsersRegistration
*/
$installer = $this;
$installer->startSetup();
Mage::getConfig()->saveConfig('preventusersregistration/settings/allowusersregistration', '0', 'websites', 2);
$installer->endSetup();
Replace websites
with the desired scope and 2
with the ID.