0
在我的Magento安裝中,我禁用了「需要電子郵件確認」功能,因爲我不需要它爲所有用戶。然而,我想擁有特定域名的用戶,「foo.com」能夠實際收到此電子郵件確認。發送新的用戶電子郵件確認到特定的電子郵件地址域
一旦他們通過電子郵件鏈接確認他們的電子郵件地址,然後我想將它們添加到特定的組。
任何人都可以提供任何方向,我應該從哪種類型的Magento修改開始?非常感謝你!
在我的Magento安裝中,我禁用了「需要電子郵件確認」功能,因爲我不需要它爲所有用戶。然而,我想擁有特定域名的用戶,「foo.com」能夠實際收到此電子郵件確認。發送新的用戶電子郵件確認到特定的電子郵件地址域
一旦他們通過電子郵件鏈接確認他們的電子郵件地址,然後我想將它們添加到特定的組。
任何人都可以提供任何方向,我應該從哪種類型的Magento修改開始?非常感謝你!
可以擴展或覆蓋
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.7.2中,您需要注意以下幾點: 1.更改: $ customer-> setIsConfirmationRequired(true); 至 $ customer-> setConfirmation(null); 2.在那之後,您需要保存它: $ customer-> save(); – ahgood