如何以编程方式确认Magento中的用户?

fdi*_*rre 6 magento

我正在编写一个自动将用户导入magento的脚本.这是一段代码:

$customer = Mage::getModel("customer/customer");
$customer->website_id = $websiteId; 
$customer->setStore($store);

$customer->loadByEmail($riga[10]);

echo "Importo ".$data[0]."\n";
echo "  email :".$data[10]."\n";

$customer->setTaxvat($data[7]);
$customer->lastname =    $lastname;
$customer->email =       $data[10]; 
$customer->password_hash = md5($data[0]);

$customer->save();
Run Code Online (Sandbox Code Playgroud)

问题是用户被创建为"未确认",而我希望它们被"确认".

我尝试过:

$customer->setConfirmation('1');
Run Code Online (Sandbox Code Playgroud)

在保存之前,但它没有用.有人知道如何确认用户吗?

谢谢!

Nic*_*Nic 17

我认为setConfirmation()正在等待确认密钥.尝试通过null,我认为它会起作用?

只是为了澄清:

$customer->save();
$customer->setConfirmation(null);
$customer->save();
Run Code Online (Sandbox Code Playgroud)

应该强制确认.