- FIX

parent ed8e8b18
...@@ -214,7 +214,6 @@ class TriggerTrigger extends \common\components\ActiveRecordModel ...@@ -214,7 +214,6 @@ class TriggerTrigger extends \common\components\ActiveRecordModel
* @return string * @return string
*/ */
public function initAction($params=array()){ public function initAction($params=array()){
return true;
$email = (!Yii::$app->user->isGuest) ? Yii::$app->user->identity->email : null; $email = (!Yii::$app->user->isGuest) ? Yii::$app->user->identity->email : null;
if ($email===null && array_key_exists('email', $params)) if ($email===null && array_key_exists('email', $params))
$email = $params['email']; $email = $params['email'];
...@@ -232,6 +231,7 @@ class TriggerTrigger extends \common\components\ActiveRecordModel ...@@ -232,6 +231,7 @@ class TriggerTrigger extends \common\components\ActiveRecordModel
$newList = $sender->createList(); $newList = $sender->createList();
$newListObject=Json::decode($newList); $newListObject=Json::decode($newList);
if (array_key_exists('result', $newListObject) && array_key_exists('id', $newListObject['result'])) { if (array_key_exists('result', $newListObject) && array_key_exists('id', $newListObject['result'])) {
return true;
$newListId=$newListObject['result']['id']; $newListId=$newListObject['result']['id'];
// Subscribe user to new List // Subscribe user to new List
$sender->subscribe(['list_ids' => $newListId, 'fields[email]' => $email, 'double_optin' => 1]); $sender->subscribe(['list_ids' => $newListId, 'fields[email]' => $email, 'double_optin' => 1]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment