Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Delete Costumer
 
ottenbacher
Jr. Member
 
Total Posts:  3
Joined:  2011-11-13
 

Hi,

i want to give the customer the option to delete his own account.

it all comes to this

$log_customer Mage::getSingleton('customer/session')->getCustomer();       
        
$log_customer->setIsActive(false);
        
$log_customer->save();
but it dosnt work very well. i have no clue whats wrong.

thanks dennis

 
Magento Community Magento Community
Magento Community
Magento Community
 
Alchemical laboratory
Jr. Member
 
Total Posts:  23
Joined:  2009-05-28
 

Do you want to delete whole customer info, or simple mark it as inactive?
If you delete is, what will be with orders, product reviews, related to him?

 
Magento Community Magento Community
Magento Community
Magento Community
 
ottenbacher
Jr. Member
 
Total Posts:  3
Joined:  2011-11-13
 

it dosnt matter.
the fastest way smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ryan Sun _Kuafu
Guru
 
Total Posts:  317
Joined:  2008-11-14
FL
 

the customer resource model does not allow you to modify is_active field,
you can either run a raw sql or add is_active field in default attributes array in Mage_Customer_Model_Entity_Customer::_getDefaultAttributes()

 
Magento Community Magento Community
Magento Community
Magento Community
 
ottenbacher
Jr. Member
 
Total Posts:  3
Joined:  2011-11-13
 

Thank you,

is there something, i have to do.
i set it inactive and save. but the user can still login…

 
Magento Community Magento Community
Magento Community
Magento Community
 
tzyganu
Mentor
 
Avatar
Total Posts:  2205
Joined:  2009-11-18
Bucharest, Romania
 

You can delete a customer like this:

$log_customer Mage::getSingleton('customer/session')->getCustomer();       
Mage::registrer('isSecureArea'true);//you can delete a customer from the admin only. This emulates the admin - sort of
$log_customer->delete();
Mage::unregister('isSecureArea');//reset admin emulation

This code will actually delete the customer from your database.

Marius.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top