本文整理汇总了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"));
}
示例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);
}
}
}
}