2016-09-23 58 views

回答

3

這是問題所在,並解決這個bug:

當我們進入一個新的電子郵件地址(未連接到extisting用戶一個),用戶對象($這個)有沒有id ($ this-> getId(); // null)尚未在Magento \ Newsletter \ Model \ Subscriber :: subscribe

驗證郵件在用戶保存之前發送出去,因此驗證鏈接中缺少用戶標識。當您點擊該鏈接時,鏈接不會執行任何操作,因爲Magento \ Newsletter \ Controller \ Subscriber \ Confirm ::執行中的驗證方法會因爲缺少ID而拒絕鏈接。

在致電$ this-> sendConfirmationRequestEmail()之前,您可以通過調用$ this-> save()輕鬆修復問題。

try { 
      $this->save(); 
      if($isConfirmNeed === true && $isOwnSubscribes === false) 
      { 
       $this->sendConfirmationRequestEmail(); 
      } else { 
       $this->sendConfirmationSuccessEmail(); 
      } 
      return $this->getStatus(); 
     } catch (\Exception $e) { 
      throw new \Exception($e->getMessage()); 
     } 

我乾脆搬到了'拯救「」' - 叫了幾行了。 sendConfirmationRequestEmailsendConfirmationSuccessEmail似乎不會改變$ thisobject,所以這是一個有效的更改,不會破壞其他任何東西。