0

I have some spam customer so how can i remove spam customer account in this site and how to disallow this account through the extension for Magento 1.9
please give me a suggestion for that if any extension link or tool then give me for Magento 1.9 please help me. Thank you.

1 Answer 1

1

HI Mohit I have no any Extention but I have one script for this your requirement is fulfilled

<?php 
require 'app/Mage.php';
Mage::app('admin')->setUseSessionInUrl(false);


$customerCollection = Mage::getModel("customer/customer")
               ->getCollection()
               ->addAttributeToFilter('email', array('like' => '%@qq.com'));

$customerIds = array();
foreach ($customerCollection as $customer) {
   $customerIds[] = $customer->getEntityId();
}

$customerCollectionNew = Mage::getModel('customer/customer')->getCollection()
               ->addAttributeToFilter('entity_id', array('in' => $customerIds));

if ($customerCollectionNew->count()) {
   foreach ($customerCollectionNew as $customer) {
       try {
           $id = $customer->getId();
           $customer->delete();
           echo 'Customer '.$id.' is deleted.<br/>';

           Mage::log('Customer '.$id.' is deleted.<br/>', null, "customer-delete.log");
       } catch (Exception $e) {
           echo "Customer ".$id." is deleted: " . $e->getMessage() . '<br/>';
           Mage::log("Customer ".$id." could not be removed: " . $e->getMessage(), null, "customer-delete.log");
       }
   }
   echo "<br>";
   echo "Completed.";
   Mage::log("Completed.", null, "customer-delete.log");
}

I hope this can help you!

2
  • HI @rohit it's working. Thanks for the help. Commented Oct 10, 2019 at 8:35
  • Hi @MOHIT good :) Commented Oct 10, 2019 at 8:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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