magento 删除我的帐户
我可以从 magento 的前端删除客户吗?我想授予用户“删除我的帐户”的访问权限。
并在控制器中放置动作。
public function deleteAccountAction()
{
$log_customer = Mage::getSingleton('customer/session')->getCustomer();
$log_customer->delete();
$this->_getSession()->logout()
->setBeforeAuthUrl(Mage::getUrl());
$this->_redirect('*/*/');
}
但这会引发异常,例如
a:5:{i:0;s:51:"无法完成此操作 非管理员操作 区域。";i:1;s:1348:"#0 /home/makegood/public_html/stage/app/code/core/Mage/Core/Model/Abstract.php(505): 法师:: throwException('不能 完成...')
如何解决这个问题。
Can i delete a customer from frontend in magento. I want to give access to the user "delete my account".
And in the controller placed the action.
public function deleteAccountAction()
{
$log_customer = Mage::getSingleton('customer/session')->getCustomer();
$log_customer->delete();
$this->_getSession()->logout()
->setBeforeAuthUrl(Mage::getUrl());
$this->_redirect('*/*/');
}
But this throws exception like
a:5:{i:0;s:51:"Cannot complete this
operation from non-admin
area.";i:1;s:1348:"#0
/home/makegood/public_html/stage/app/code/core/Mage/Core/Model/Abstract.php(505):
Mage::throwException('Cannot
complete...')
How to solve this issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在从前端删除客户之前,您必须设置
Mage::register('isSecureArea', true);
You have to set
Mage::register('isSecureArea', true);
before deleting the customer from frontend您可以使用
setIsActive(false)
来阻止用户登录,而不是删除。该帐户仍会显示在管理员中,但已被停用。
Instead of deleting you could
setIsActive(false)
which would stop the user from logging in.The account would still show in the admin but be deactivated.