当前位置: 首页>>代码示例>>PHP>>正文


PHP MailChimp::addSubscriber方法代码示例

本文整理汇总了PHP中MailChimp::addSubscriber方法的典型用法代码示例。如果您正苦于以下问题:PHP MailChimp::addSubscriber方法的具体用法?PHP MailChimp::addSubscriber怎么用?PHP MailChimp::addSubscriber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MailChimp的用法示例。


在下文中一共展示了MailChimp::addSubscriber方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionSynchronize

 public function actionSynchronize()
 {
     set_time_limit(7200);
     $idNameGroup = array();
     $criteria = new CDbCriteria();
     $mSubG = SubscriberGroup::model()->findAll($criteria);
     if (count($mSubG) > 0) {
         foreach ($mSubG as $i) {
             $idNameGroup[$i->id] = $i->name;
         }
     }
     $criteria = new CDbCriteria();
     $criteria->addCondition('subscriber_group_id = 1 OR subscriber_group_id = 2');
     $mSubscriber = Subscriber::model()->findAll($criteria);
     //var_dump($mSubscriber);
     $test = array();
     if (count($mSubscriber) > 0) {
         Yii::import('ext.MailChimp.MailChimp', true);
         foreach ($mSubscriber as $item) {
             $mailChimp = new MailChimp();
             //                    $mailChimp->removeSubscriber('verzdev2@gmail.com');
             //                    die;
             $sGroupName = Yii::app()->params['mailchimp_title_groups'];
             $sGroup = strtolower($idNameGroup[$item->subscriber_group_id]);
             $merge_vars = array('GROUPINGS' => array(array('name' => $sGroupName, 'groups' => $sGroup)));
             if ($item->status == 1) {
                 //                        echo '<pre>';
                 //echo print_r($merge_vars);
                 //echo '</pre>';
                 //echo $item->email;
                 //die();
                 $test[] = $mailChimp->addSubscriber($item->email, $merge_vars);
             } else {
                 $mailChimp->removeSubscriber($item->email);
             }
         }
     }
     Yii::app()->user->setFlash('mailchimp', "Synchronize Mailling list successfully!");
     $this->redirect(Yii::app()->createAbsoluteUrl("admin/setting/mailchimp"));
 }
开发者ID:jasonhai,项目名称:onehome,代码行数:40,代码来源:MailchimpController.php

示例2: mailchimp

 public function mailchimp()
 {
     set_time_limit(7200);
     $idNameGroup = array();
     $criteria = new CDbCriteria();
     //            $criteria->compare('t.status',1);
     $mSubG = SubscriberGroup::model()->findAll($criteria);
     if (count($mSubG) > 0) {
         foreach ($mSubG as $i) {
             $idNameGroup[$i->id] = $i->name;
         }
     }
     $criteria = new CDbCriteria();
     $mSubscriber = Subscriber::model()->findAll($criteria);
     $test = array();
     if (count($mSubscriber) > 0) {
         Yii::import('ext.MailChimp.MailChimp', true);
         foreach ($mSubscriber as $item) {
             $mailChimp = new MailChimp();
             //                    $mailChimp->removeSubscriber('verzdev2@gmail.com');
             //                    die;
             $sGroupName = Yii::app()->params['mailchimp_title_groups'];
             $sGroup = strtolower($idNameGroup[$item->subscriber_group_id]);
             $merge_vars = array('GROUPINGS' => array(array('name' => $sGroupName, 'groups' => $sGroup)));
             if ($item->status == 1) {
                 $test[] = $mailChimp->addSubscriber($item->email, $merge_vars);
             } else {
                 $mailChimp->removeSubscriber($item->email);
             }
         }
     }
 }
开发者ID:jasonhai,项目名称:onehome,代码行数:32,代码来源:Subscriber.php


注:本文中的MailChimp::addSubscriber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。