3

How to deactivate or inactive the user automatically after 90 days if he had no purchase with in 90 days. in our website

4

You can write custom module to handle this task. Following logic you can use: when customer logged in, your observer tracks login time and save this time to last_activated attribute of customer. Before this you should check if difference between current time and last_activated time less or nor to particular period which is given in your configuration, see implemention:
/app/code/community/SSD/CustomerActivation/etc/config.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <SSD_CustomerActivation>
            <version>0.1.0</version>
        </SSD_CustomerActivation>
    </modules>
    <frontend>
        <events>
            <customer_customer_authenticated>
                <observers>
                    <ssd_customeractivation>
                        <type>singleton</type>
                        <class>SSD_CustomerActivation_Model_Observer</class>
                        <method>customerCustomerAuthenticated</method>
                    </ssd_customeractivation>
                </observers>
            </customer_customer_authenticated>
        </events>
    </frontend>
    <global>
        <models>
            <ssd_customeractivation>
                <class>SSD_CustomerActivation_Model</class>
            </ssd_customeractivation>
        </models>
        <resources>
            <ssd_customeractivation_setup>
                <setup>
                    <module>SSD_CustomerActivation</module>
                </setup>
            </ssd_customeractivation_setup>
        </resources>
    </global>
</config>

/app/code/community/SSD/CustomerActivation/etc/system.xml:

<?xml version="1.0"?>
<config>
    <sections>
        <customer translate="label" module="customer">
            <groups>
                <expiration translate="label">
                    <label>Account expiration</label>
                    <sort_order>100</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>0</show_in_store>
                    <fields>
                        <enabled>
                            <label>Enabled</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <sort_order>4</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>0</show_in_store>
                        </enabled>
                        <period>
                            <label>Expiration Period</label>
                            <frontend_type>text</frontend_type>
                            <validate>validate-number</validate>
                            <sort_order>5</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>0</show_in_store>
                            <comment>Account expiration period with hours</comment>
                            <depends>
                                <enabled>1</enabled>
                            </depends>
                        </period>
                    </fields>
                </expiration>
            </groups>
        </customer>
    </sections>
</config>

/app/code/community/SSD/CustomerActivation/sql/ssd_customeractivation_setup/mysql4-install-0.1.0.php:

<?php
/* @var $installer Mage_Core_Model_Resource_Setup */
$installer = $this;

$installer->startSetup();
$setup         = new Mage_Eav_Model_Entity_Setup('core_setup');
$attributeCode = 'last_activated';
$setup->addAttribute('customer', $attributeCode, array(
    'label'        => 'Last Activated',
    'type'         => 'int',
    'input'        => 'text',
    'visible'      => true,
    'required'     => false,
    'position'     => 130,
));
$installer->endSetup();

/app/code/community/SSD/CustomerActivation/Model/Observer.php:

<?php
class  SSD_CustomerActivation_Model_Observer
{
    public function customerCustomerAuthenticated($observer)
    {
        /**
         * @var $customer Mage_Customer_Model_Customer
         */
        $customer = $observer->getEvent()->getModel();
        if (Mage::getStoreConfig('customer/expiration/enabled')) {
            $period        = intval(Mage::getStoreConfig('customer/expiration/period'));
            $lastActivated = $customer->getLastActivated();
            $now           = time();
            if ($period * 3600 < $now - $lastActivated) {
                Mage::throwException('Customer account expired.');
            }
            $customer->setLastActivated(time())->save();
        }
    }
}
4

Look at this module from Vinai Kopp magentocommerce.com/magento-connect/customer-activation.html, then extend on the functionality by adding a cron that would de-activate the customers after they have been in-active for 90 days.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.