2012-09-07 64 views
0

在我的Magento安装中,我禁用了“需要电子邮件确认”功能,因为我不需要它为所有用户。然而,我想拥有特定域名的用户,“foo.com”能够实际收到此电子邮件确认。发送新的用户电子邮件确认到特定的电子邮件地址域

一旦他们通过电子邮件链接确认他们的电子邮件地址,然后我想将它们添加到特定的组。

任何人都可以提供任何方向,我应该从哪种类型的Magento修改开始?非常感谢你!

回答

1

可以扩展或覆盖

app/code/core/Mage/Customer/controllers/AccountController.php 

public function createPostAction() 
{ 
    if (true === $validationResult) { 
     $customer->save(); 

     // Do your custom Code here to match the domains you want to make Confirmation Required for them. 
     $patterns = array('@foo.com','@boo.com','@bar.com'); 
     $patterns_flattened = implode('|', $patterns); 
     if (preg_match('/'. $patterns_flattened .'/i', $customer->getEmail(), $matches)) 
     { 
      $customer->setIsConfirmationRequired(true); 
     } 

     if ($customer->isConfirmationRequired()) { 
      $customer->sendNewAccountEmail('confirmation', $this->_getSession()->getBeforeAuthUrl()); 
      $this->_getSession()->addSuccess($this->__('Account confirmation is required. Please, check your e-mail for confirmation link. To resend confirmation email please <a href="%s">click here</a>.', 
       Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail()) 
      )); 
      $this->_redirectSuccess(Mage::getUrl('*/*/index', array('_secure'=>true))); 
      return; 
     } 
     else { 
      $this->_getSession()->setCustomerAsLoggedIn($customer); 
      $url = $this->_welcomeCustomer($customer); 
      $this->_redirectSuccess($url); 
      return; 

     } 
    } 
} 

所以,你可以做到这一点在两种方式

启用激活电子邮件并设置$customer->setIsConfirmationRequired(false);如果邮件不匹配,你要验证的域(推荐)

禁用激活电子邮件和设置$customer->setIsConfirmationRequired(true);邮件是否符合您要验证

临屋域非货币

+1

供参考。在版本1.7.2中,您需要注意以下几点: 1.更改: $ customer-> setIsConfirmationRequired(true); 至 $ customer-> setConfirmation(null); 2.在那之后,您需要保存它: $ customer-> save(); – ahgood

相关问题