本文整理汇总了PHP中MCAPI::listMemberInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP MCAPI::listMemberInfo方法的具体用法?PHP MCAPI::listMemberInfo怎么用?PHP MCAPI::listMemberInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCAPI
的用法示例。
在下文中一共展示了MCAPI::listMemberInfo方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: moveSubscriber
public function moveSubscriber()
{
$api = new MCAPI($this->_apiKey);
$retval = $api->lists();
if ($api->errorCode) {
Mage::getSingleton('core/session')->addError($this->__('Error: %s', $api->errorMessage));
} else {
foreach ($retval['data'] as $val) {
if ($val['name'] === "Prospects") {
$prospectListId = $val['id'];
} elseif ($val['name'] === "Fashion Eyewear Customers") {
$customerListId = $val['id'];
}
}
if ($api->errorCode != '') {
// an error occurred while logging in
Mage::log('Error Code: ' . $api->errorCode);
Mage::log('Error Message: ' . $api->errorMessage);
die;
}
$retval = $api->listMembers($prospectListId, 'subscribed', null, 0, 10000);
//var_dump($retval);die;
if (!$retval) {
Mage::log('Error Code: ' . $api->errorCode);
Mage::log('Error Message: ' . $api->errorMessage);
} else {
foreach ($retval['data'] as $member) {
//echo $member['email']." - ".$member['timestamp']."<br />";
$customerModel = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('*')->addAttributeToFilter('email', $member['email'])->setPage(1, 1);
$customers = $customerModel->getData();
$customerId = $customers[0]['entity_id'];
$orders = Mage::getResourceModel('sales/order_collection')->addFieldToSelect('*')->addFieldToFilter('customer_id', $customerId)->getData();
if (!empty($orders)) {
//if ($member['email'] === 'ruffian.ua@gmail.com') {
$memInfo = $api->listMemberInfo($prospectListId, array($member['email']));
$firstname = $memInfo['data'][0]['merges']['FNAME'];
if (empty($firstname)) {
$firstname = Mage::getModel('customer/customer')->load($customerId)->getFirstname();
}
$retuns = $api->listUnsubscribe($prospectListId, $member['email'], 1);
if (!$retuns) {
Mage::log('Unsubscribe Error Code: ' . $api->errorCode);
Mage::log('Unsubscribe Error Message: ' . $api->errorMessage);
}
$merge_vars = array('FNAME' => $firstname);
$retsub = $api->listSubscribe($customerListId, $member['email'], $merge_vars);
if (!$retsub) {
Mage::log('Subscribe Error Code: ' . $api->errorCode);
Mage::log('Subscribe Error Message: ' . $api->errorMessage);
}
//}
}
}
}
}
}
示例2: testAddToListWithoutName
public function testAddToListWithoutName()
{
$hookUrl = '/mailchimp?email=custom1&listid=' . MAIL_CHIMP_LIST_ID . '&apikey=' . MAIL_CHIMP_API_KEY;
$emailUniq = time();
$email = 'tom.' . $emailUniq . '@simpleweb.co.uk';
$fields = array('custom1' => $email);
//Do the post.
$ch = curl_init(LOCAL_URL . $hookUrl);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$c = curl_exec($ch);
$response = curl_getinfo($ch);
$this->assertEquals(200, $response['http_code']);
//Try and retrieve the added user from mailchimp.
$api = new MCAPI(MAIL_CHIMP_API_KEY);
$retval = $api->listMemberInfo(MAIL_CHIMP_LIST_ID, $email);
$this->assertFalse((bool) $api->errorCode);
$this->assertEquals($email, $retval['data'][0]['merges']['EMAIL']);
$this->assertEquals("", $retval['data'][0]['merges']['FNAME']);
$this->assertEquals("", $retval['data'][0]['merges']['LNAME']);
}
示例3: actionCheckIfSubscribed
public function actionCheckIfSubscribed()
{
// get post variables
$email = craft()->request->getParam('email', '');
$formListId = craft()->request->getParam('lid', '');
$vars = craft()->request->getParam('mcvars', array());
$redirect = craft()->request->getParam('redirect', '');
if ($email != '' && $this->_validateEmail($email)) {
// validate email
// include mailchimp api class
require_once CRAFT_PLUGINS_PATH . 'mailchimpsubscribe/vendor/mcapi/MCAPI.class.php';
// get plugin settings
// passes list id from form value lid
$settings = $this->_init_settings();
$listIdStr = $formListId != '' ? $formListId : $settings['mcsubListId'];
// check if we got an api key and a list id
if ($settings['mcsubApikey'] != '' && $listIdStr != '') {
// create a new api instance, and check if this user is on this list
$api = new \MCAPI($settings['mcsubApikey']);
$retval = $api->listMemberInfo($listIdStr, $email);
if ($api->errorCode) {
// an API error occurred
$this->_setMessage($api->errorCode, $email, $vars, $api->errorMessage);
} else {
if ($retval['errors']) {
$this->_setMessage(1000, $email, $vars, "The email address passed does not exist on this list", false, $redirect);
} else {
$vars['subscriberInfo'] = $retval;
$this->_setMessage(200, $email, $vars, "The email address passed exists on this list", true, $redirect);
}
}
} else {
// error, no API key or list id
$this->_setMessage(2000, $email, $vars, "API Key or List ID not supplied. Check your settings.", false, $redirect);
}
} else {
// error, invalid email
$this->_setMessage(1000, $email, $vars, "Invalid email", false, $redirect);
}
}
示例4: ot_wop_protected_page_redirect
function ot_wop_protected_page_redirect()
{
$ot_wop_settings = get_option('ot_wop_settings');
if (is_page($ot_wop_settings['offered_page'])) {
define('DONOTCACHEPAGE', 1);
require_once 'inc/mcapi/MCAPI.class.php';
$apiKey = $ot_wop_settings['api_key'];
$api = new MCAPI($apiKey);
$listId = $ot_wop_settings['mc_list_id'];
$str = $_SERVER['QUERY_STRING'];
parse_str($str, $output);
if ($output['email']) {
$email = $output['email'];
} elseif ($output['EMAIL']) {
$email = $output['EMAIL'];
} elseif ($output['e']) {
$email = $output['e'];
}
$retval = $api->listMemberInfo($listId, array($email));
$datetime1 = new DateTime($retval['data'][0]['timestamp']);
// $datetime1 = new DateTime('2014-05-12 18:23:37');
$datetime2 = new DateTime('NOW');
// print_r($datetime2);
$difference = $datetime1->diff($datetime2);
// Uncomment this stuff to debug!
// print_r($difference);
// error_log($difference->d .' but days open should be: '.$ot_wop_settings['days_open']. 'and days closed should be '. $ot_wop_settings['days_close']);
$days_between = $difference->days;
// if the days from signup is past the open time (or on it) and on, but not past the days closed time, don't do anything.
if ($days_between >= $ot_wop_settings['days_open'] and $days_between <= $ot_wop_settings['days_close'] && !empty($email)) {
// for all other cases -- redirect 'em.
} else {
wp_redirect(get_permalink($ot_wop_settings['fallback_page']));
}
}
// end check for page
}
示例5: renew
public static function renew($params)
{
$result = array();
$result['success'] = true;
if(empty($params['allow_work']))
{
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_("Error");
return $result;
}
unset($params['allow_work']);
//oseExit($params);
$db = oseDB::instance();
$post = JRequest::get('post');
$msc_id = $params['msc_id'];
$member_id = $params['member_id'];
if(empty($msc_id))
{
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_("Renew Msc: No Msc ID");
return $result;
}
// get the list id of msc
$query = "SELECT * FROM `#__osemsc_ext` WHERE `id` = '{$msc_id}' AND `type` = 'mailchimp'";
$db->setQuery($query);
$data = $db->loadObject();
$data = oseJson::decode($data->params);
if(empty($data->list_id) || empty($data->enable))
{
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_("Done");
return $result;
}
require_once(OSEMSC_B_LIB.DS.'MCAPI.class.php');
$oseMscConfig= oseRegistry :: call('msc')->getConfig(null, 'obj');
$APIKey = $oseMscConfig->mailchimp_api_key;
$api = new MCAPI($APIKey);
$query = "SELECT email FROM `#__users` WHERE `id` = ".(int) $member_id;
$db->setQuery($query);
$email = $db->loadResult();
$MC_MemInfo = $api->listMemberInfo($data->list_id,$email);
if($MC_MemInfo['success'])
{
if($MC_MemInfo['data'][0]['status'] == 'subscribed')
{
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_("Done");
return $result;
}
}
$join = $api->listSubscribe($data->list_id,$email);
if(!$join)
{
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_("Join MailChimp Failed");
return $result;
}
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_("Done");
return $result;
}
示例6: cancel
public static function cancel($params)
{
$result = array();
$result['success'] = true;
if(empty($params['allow_work']))
{
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_("Error");
return $result;
}
unset($params['allow_work']);
$db = oseDB::instance();
$msc_id =$params['msc_id'];
$member_id = $params['member_id'];
// get the list id of msc
$query = "SELECT * FROM `#__osemsc_ext` WHERE `id` = '{$msc_id}' AND `type` = 'mailchimp'";
$db->setQuery($query);
$data = $db->loadObject();
$data = oseJson::decode($data->params);
if(empty($data->list_id) || empty($data->enable) || empty($data->unsubscribe_enable))
{
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_("Done");
return $result;
}
require_once(OSEMSC_B_LIB.DS.'MCAPI.class.php');
$oseMscConfig= oseRegistry :: call('msc')->getConfig(null, 'obj');
$APIKey = $oseMscConfig->mailchimp_api_key;
$api = new MCAPI($APIKey);
$query = "SELECT email FROM `#__users` WHERE `id` = ".(int) $member_id;
$db->setQuery($query);
$email = $db->loadResult();
$MC_MemInfo = $api->listMemberInfo($data->list_id,$email);
if($MC_MemInfo['success'])
{
$api->listUnsubscribe($data->list_id,$email,$data->delete,$data->sendGoodbye,$data->sendNotify);
}
return $result;
}
示例7: onAfterWrite
public function onAfterWrite()
{
parent::onAfterWrite();
// Define Related MCList Object
$list = $this->getComponent("MCList");
// Store The True Changed Fields Array On First Write
if ($this->getWriteCount() == 1) {
$cf = $this->getChangedFields(false, 2);
// Define Change Fields Array
$this->setOriginalChangedFields($cf);
// Store Original (First Write) Change Fields For Use On Second Write
} else {
if ($this->getWriteCount() > 1 && $this->getSyncMailChimp() && !empty($this->Email) && !empty($list->ID)) {
$apikey = SiteConfig::current_site_config()->getMCAPIKey();
$api = new MCAPI($apikey);
// Define The Change Fields Array Which We Stored On The First Write Iteration For Use On The Second Write (When Components Are Written)
if ($this->getWriteCount() == 2) {
$cf = $this->getOriginalChangedFields();
}
$Class = array();
$Class["MCSubscription"] = $this;
$where = "\"MCListID\" = '" . $this->MCListID . "' AND \"SyncDirection\" IN ('Export','Both')";
if (!empty($this->getComponent("Member")->ID)) {
$Class['Member'] = $this->getComponent("Member");
SS_Log::log("Sub ID " . $this->ID . " Has A Related Member Object..", SS_Log::NOTICE);
} else {
// If No Related Member Object Only Deal With Subscription Record Merge Data
$where .= " AND \"OnClass\" = 'MCSubscription'";
SS_Log::log("Sub ID " . $this->ID . " Has No Related Member Object..", SS_Log::NOTICE);
}
$dl = new DataList("MCListField");
$mappings = $dl->where($where);
$merge_vars = array();
foreach ($mappings as $map) {
$merge_vars[$map->MergeTag] = $Class[$map->OnClass]->getField($map->FieldName);
}
if (isset($cf['ID'])) {
// If Adding a New Subscription
$result = $api->listSubscribe($list->ListID, $this->Email, $merge_vars, 'html', $this->DoubleOptIn);
// If Successfully Added a New Subscription Make a Second Call to Return the MailChimp Member (Web) && Email ID's
if (empty($api->errorCode)) {
SS_Log::log("API Call Success: listSubscribe(" . $list->ListID . ", " . $this->Email . "); for Subscription ID " . $this->ID, SS_Log::NOTICE);
$retval = $api->listMemberInfo($list->ListID, $this->Email);
if (empty($api->errorCode)) {
SS_Log::log("API Call Success: listMemberInfo(" . $list->ListID . ", " . $this->Email . "); for Subscription ID " . $this->ID, SS_Log::NOTICE);
SS_Log::log("Calling Additional write() for Subscription ID " . $this->ID . " to Save MailChimp Created Data", SS_Log::NOTICE);
$this->setField("MCMemberID", $retval['data'][0]['web_id']);
// Set The MailChimp Member (Web) ID for this Member (Which Is Static - Used For MC - Site Imports)
$this->setField("MCEmailID", $retval['data'][0]['id']);
// Set The MailChimp Email ID for this Member (Which Updates When E-mail Updates - Used For Site - MC Exports)
$this->setWriteCount();
$this->write();
} else {
SS_Log::log("API Call Failed: listMemberInfo(" . $list->ListID . ", " . $this->Email . "); for Subscription ID " . $this->ID . " | Error Code = " . $api->errorCode . " | Error Message = " . $api->errorMessage, SS_Log::ERR);
}
} else {
SS_Log::log("API Call Failed: listSubscribe(" . $list->ListID . ", " . $this->Email . "); for Subscription ID " . $this->ID . " | Error Code = " . $api->errorCode . " | Error Message = " . $api->errorMessage, SS_Log::ERR);
}
} else {
if (isset($cf['Subscribed']) && !empty($this->Subscribed)) {
// If Just Re-Subscribed (This Will Replace Previous MC Record With New One Rather Than Re-Subscribing Existing)
$result = $api->listSubscribe($list->ListID, $this->Email, $merge_vars, 'html', $this->DoubleOptIn);
// Must use E-mail For Re-Subscription as listSubscribe() assumes a new user (it actually deletes the existing 'un-subscribed' MailChimp record for the provided e-mail and re-adds the user)
if (empty($api->errorCode)) {
SS_Log::log("API Call Success: listSubscribe(" . $list->ListID . ", " . $this->Email . "); for Subscription ID " . $this->ID, SS_Log::NOTICE);
} else {
SS_Log::log("API Call Failed: listSubscribe(" . $list->ListID . ", " . $this->Email . "); for Subscription ID " . $this->ID . " | Error Code = " . $api->errorCode . " | Error Message = " . $api->errorMessage, SS_Log::ERR);
}
} else {
if (isset($cf['Subscribed']) && empty($this->Subscribed)) {
// If Just Unsubscribed
$result = $api->listUnsubscribe($list->ListID, $this->getMailChimpIdentifier());
if (empty($api->errorCode)) {
SS_Log::log("API Call Success: listUnsubscribe(" . $list->ListID . ", " . $this->getMailChimpIdentifier() . "); for Subscription ID " . $this->ID, SS_Log::NOTICE);
} else {
SS_Log::log("API Call Failed: listUnsubscribe(" . $list->ListID . ", " . $this->getMailChimpIdentifier() . "); for Subscription ID " . $this->ID . " | Error Code = " . $api->errorCode . " | Error Message = " . $api->errorMessage, SS_Log::ERR);
}
} else {
if (!empty($this->Subscribed)) {
// If Updating an Existing Subscription (That Hasnt Already Unsubscribed)
$result = $api->listUpdateMember($list->ListID, $this->getMailChimpIdentifier(), $merge_vars);
// If Successfully Updated a Subscription Make a Second Call to Return the MailChimp Member Email ID
if (empty($api->errorCode)) {
SS_Log::log("API Call Success: listUpdateMember(" . $list->ListID . ", " . $this->getMailChimpIdentifier() . "); for Subscription ID " . $this->ID, SS_Log::NOTICE);
if (isset($cf['Email'])) {
$retval = $api->listMemberInfo($list->ListID, $this->Email);
// Call Must Use Email As MCEmailID Will Be Outdated If Last Update Was An Email Change
if (empty($api->errorCode)) {
SS_Log::log("API Call Success: listMemberInfo(" . $list->ListID . ", " . $this->Email . "); for Subscription ID " . $this->ID, SS_Log::NOTICE);
SS_Log::log("Calling Additional write() for Subscription ID " . $this->ID . " to Save Updated MailChimp Email ID", SS_Log::NOTICE);
$this->setField("MCEmailID", $retval['data'][0]['id']);
// Update The MailChimp Email ID for this Member (Which Updates When E-mail Updates)
$this->setSyncMailChimp(false);
$this->write();
} else {
SS_Log::log("API Call Failed: listMemberInfo(" . $list->ListID . ", " . $this->Email . "); for Subscription ID " . $this->ID . " | Error Code = " . $api->errorCode . " | Error Message = " . $api->errorMessage, SS_Log::ERR);
}
}
} else {
SS_Log::log("API Call Failed: listUpdateMember(" . $list->ListID . ", " . $this->getMailChimpIdentifier() . "); for Subscription ID " . $this->ID . " | Error Code = " . $api->errorCode . " | Error Message = " . $api->errorMessage, SS_Log::ERR);
//.........这里部分代码省略.........
示例8: MCAPI
<?php
/**
This Example shows how to pull the Info for a Member of a List using the MCAPI.php
class and do some basic error checking.
**/
require_once '../mcapi.php';
require_once 'config/config.inc.php';
//contains apikey
$api = new MCAPI($apikey);
$retval = $api->listMemberInfo($listId, array($my_email, $boss_man_email));
if ($api->errorCode) {
echo "Unable to load listMemberInfo()!\n";
echo "\tCode=" . $api->errorCode . "\n";
echo "\tMsg=" . $api->errorMessage . "\n";
} else {
echo "Success:" . $retval['success'] . "\n";
echo "Errors:" . sizeof($retval['error']) . "\n";
//below is stupid code specific to what is returned
//Don't actually do something like this.
$i = 0;
foreach ($retval['data'] as $k => $v) {
echo 'Member #' . ++$i . "\n";
if (is_array($v)) {
//handle the merges
foreach ($v as $l => $w) {
if (is_array($w)) {
echo "\t{$l}:\n";
foreach ($w as $m => $x) {
echo "\t\t{$m} = {$x}\n";
}
示例9: bam
$sql = $report->getSQL('LOWER(p.email) as loweremail, p.email, p.first_name, p.last_name, p.gender, p.age_bracket, p.status, p.congregationid');
$report_members = $db->queryAll($sql, null, null, true);
check_db_result($report_members);
unset($report_members['']);
// with no email.
if ($DEBUG > 1) {
bam("PERSONS FROM REPORT (excl email-less persons):");
bam($report_members);
bam("========================");
}
// For each chunk of report members, retrieve their details from mailchimp.
// If found, update details if needed
// If not found, add to "add" list
$to_add = array();
foreach (array_chunk($report_members, 49, true) as $chunk) {
$list_infos = $api->listMemberInfo($list_id, array_keys($chunk));
if (!empty($api->errorMessage)) {
trigger_error("Mailchimp API Error calling listMemberInfo(): " . $api->errorMessage, E_USER_ERROR);
}
if ($DEBUG > 1) {
bam("LIST INFOS:");
bam($list_infos);
bam("========================");
}
foreach ($list_infos['data'] as $list_member) {
if (!empty($list_member['error'])) {
$to_add[] = getMergeVars($chunk[strtolower($list_member['email_address'])], $list_member['email_address']);
} else {
$merge_vars = getMergeVars($chunk[strtolower($list_member['email'])], $list_member['email']);
$do_update = FALSE;
foreach ($merge_vars as $k => $v) {
示例10: getMemberMailingListSubscriptionInfo
public function getMemberMailingListSubscriptionInfo()
{
/*
* Get MailChimp subscription info for member by email address, or blank info for new member.
* Returns an array including a 'subscribed' flag
* and, (if that's true,) an array of all Interest Groups,
* each with a flag signifying whether the member is subscribed:
* (
* subscribed => bool,
* groups => (
* 'group1' => bool,
* 'group2' => bool,
* 'groupN' => bool
* )
* )
* OR returns an error string.
*/
require_once 'mailchimp-api/MCAPI.class.php';
require_once 'mailchimp-api/config.inc.php';
$mc_api = new MCAPI($mailchimp_api_key);
// Get all Interest Groups
$mc_interest_groups = $mc_api->listInterestGroups($mailchimp_list_id);
if ($mc_api->errorCode) {
return "MailChimp Error (getting groups): " . $mc_api->errorMessage . " (Code: " . $mc_api->errorCode . ")";
}
// Init the return structure
$mc_member_subscription_info = array('subscribed' => false, 'groups' => array());
foreach ($mc_interest_groups['groups'] as $group) {
$mc_member_subscription_info['groups'][$group] = false;
}
$unsubscribed_info = $mc_member_subscription_info;
if ($this->data->id == 0) {
// New member; non-subscribed
return print_r($this, true);
return $unsubscribed_info;
} else {
// Existing member
$email = $this->emailAddress;
// (empty() doesn't seem to take class member as param)
if (empty($email)) {
return "Member e-mail address ('{$this->emailAddress}') invalid; no subscription information possible.";
}
// Get member info in MailChimp
$mc_list_member_info = $mc_api->listMemberInfo($mailchimp_list_id, $this->emailAddress);
if ($mc_api->errorCode) {
switch ($mc_api->errorCode) {
case 215:
// List_NotSubscribed
// List_NotSubscribed
case 232:
// Email_NotExists
// Email_NotExists
case 233:
// Email_NotSubscribed
// Member not yet subscribed.
return $unsubscribed_info;
default:
return "MailChimp Error (getting member info): " . $mc_api->errorMessage . " (Code: " . $mc_api->errorCode . ")";
}
}
$mc_member_subscription_info['subscribed'] = $mc_list_member_info['status'] == 'subscribed';
// subscribed groups
$mc_groups_list_str = $mc_list_member_info['merges']['INTERESTS'];
$mc_member_groups = explode(', ', $mc_groups_list_str);
foreach ($mc_member_groups as $group) {
if (isset($mc_member_subscription_info['groups'][$group])) {
$mc_member_subscription_info['groups'][$group] = true;
}
}
}
return $mc_member_subscription_info;
}
示例11: ot_countdown_timer
function ot_countdown_timer($atts)
{
extract(shortcode_atts(array(), $atts));
ob_start();
?>
<?php
define('DONOTCACHEPAGE', 1);
$ot_wop_settings = get_option('ot_wop_settings');
require_once 'mcapi/MCAPI.class.php';
$apiKey = $ot_wop_settings['api_key'];
$api = new MCAPI($apiKey);
$listId = $ot_wop_settings['mc_list_id'];
$str = $_SERVER['QUERY_STRING'];
parse_str($str, $output);
if ($output['email']) {
$email = $output['email'];
} elseif ($output['EMAIL']) {
$email = $output['EMAIL'];
} elseif ($output['e']) {
$email = $output['e'];
}
$retval = $api->listMemberInfo($listId, array($email));
// $date = strtotime();
// $date = strtotime($date + $ot_wop_settings['days_close'] .' days');
$now = new DateTime('NOW');
// print_r($now);
// $now = new DateTime('2014-05-12 18:23:37');
$signedup = new DateTime($retval['data'][0]['timestamp']);
$windowCloses = new DateTime($retval['data'][0]['timestamp']);
$windowCloses->add(new DateInterval("P" . $ot_wop_settings['days_close'] . "D"));
// print_r($windowCloses);
$timeRemaining = $now->diff($windowCloses);
// print_r($timeRemaining);
$days = '+' . $timeRemaining->format("%d") . 'd';
$hours = '+' . $timeRemaining->format("%H") . 'h';
$minutes = '+' . $timeRemaining->format("%i") . 'm';
$seconds = '+' . $timeRemaining->format("%s");
// Uncomment this stuff to debug!
// print_r($difference);
// print_r($date);
// if the email address is not provided...don't show anything
if (!empty($email)) {
?>
<style type="text/css" media="screen">
/* line 141, /Users/joseph/Sites/unitedwayla/wp-content/themes/UnitedWay/css/less/bmia.less */
.countdown-wrapper {
overflow: hidden;
padding: 10px;
}
.countdown-wrapper .countdown-section {
font-family: 'Lucida Grande', Lucida, Verdana, sans-serif;
color: #000;
display: inline-block;
float: left;
text-align: center;
margin: 0 4px;
}
/* line 146, /Users/joseph/Sites/unitedwayla/wp-content/themes/UnitedWay/css/less/bmia.less */
.countdown-wrapper .countdown-section .countdown-amount {
border-radius: 4px;
background: #000;
background-image: -webkit-linear-gradient(top, #000 0%, #686868 50%, #000 50%, #535050 100%);
background-image: -moz-linear-gradient(top, #000 0%, #686868 50%, #000 50%, #535050 100%);
background-image: linear-gradient(top, #000 0%, #686868 50%, #000 50%, #535050 100%);
color: #fff;
font-size: 44px;
text-align: center;
display: block;
line-height: 46px;
padding: 10px 20px;
}
/* line 151, /Users/joseph/Sites/unitedwayla/wp-content/themes/UnitedWay/css/less/bmia.less */
.countdown-wrapper .countdown-section .countdown-period {
display: block;
font-size: 16px;
font-weight: bold;
text-transform: uppercase;
padding-top: 8px;
}
.countdown-wrapper {
width: 420px;
margin: 0 auto;
}
</style>
<div style="" class="countdown-wrapper">
<script>
jQuery(document).ready(function() {
jQuery('#defaultCountdown').countdown( {
until: '<?php
echo $days . ', ' . $hours . ', ' . $minutes . ', ' . $seconds;
?>
',
padZeroes: true
});
});
</script>
<div id="defaultCountdown"></div>
</div><!--end countdown-wrapper -->
<?php
//.........这里部分代码省略.........
示例12: UpdateMemberStatus
public function UpdateMemberStatus($list = null, $checkpoint = null)
{
if (!is_object($list) || !is_object($checkpoint)) {
SS_Log::log("UpdateMemberStatus() Requireds MCList Object and Sync Checkpoint Parameters!", SS_Log::ERR);
return false;
}
$api = new MCAPI($this->apikey);
$retval = $api->listMembers($list->ListID, 'unsubscribed', $checkpoint->LastSuccessfulSync, 0, 5000);
if ($api->errorCode) {
SS_Log::log("API Call Failed: listMembers('" . $list->ListID . "', 'unsubscribed', '" . $checkpoint->LastSuccessfulSync . "', 0, 5000); Error Code = " . $api->errorCode . " | Error Message = " . $api->errorMessage, SS_Log::ERR);
return false;
} else {
SS_Log::log("API Call Success: listMembers('" . $list->ListID . "', 'unsubscribed', '" . $checkpoint->LastSuccessfulSync . "', 0, 5000); Returned Members = " . $retval['total'], SS_Log::NOTICE);
if ($retval['total'] > 0) {
foreach ($retval['data'] as $member) {
$where = "\"MCListID\" = '" . $list->ID . "' AND ";
// Try and Lookup Member Date By E-mail To Get MailChimp ID for More Accurate Updates
// (i.e. E-mail Updated on MailChimp Would Otherwise Create New Sub Rather Than Update Existing)
$memberInfo = $api->listMemberInfo($list->ListID, $member['email']);
// Members Yet To Confirm Subscribption Shouldn't Be Returned in listMembers()
// listMemberInfo() Error Would Suggest The Record Has Been DELETED from MailChimp (Rather Than Just Unsubscribed)
if ($api->errorCode) {
SS_Log::log(" - API Call Failed: listMemberInfo('" . $list->ListID . "', '" . $member['email'] . "'); Error Code = " . $api->errorCode . " | Error Message = " . $api->errorMessage, SS_Log::ERR);
$where .= "LOWER(\"Email\") = '" . strtolower($member['email']) . "'";
$delete_record = true;
SS_Log::log("Member Record DELETED In MailChimp (Not Just Unsubscribed)", SS_Log::NOTICE);
} else {
SS_Log::log(" - API Call Success: listMemberInfo('" . $list->ListID . "', '" . $member['email'] . "');", SS_Log::NOTICE);
$where .= "\"MCMemberID\" = '" . $memberInfo['data'][0]['web_id'] . "'";
$delete_record = false;
}
SS_Log::log(" - MEMBER " . $member['email'] . " (MCID: " . $memberInfo['data'][0]['web_id'] . ")", SS_Log::NOTICE);
SS_Log::log(" - MailChimp Updated: " . $member['timestamp'], SS_Log::NOTICE);
$dl = new DataList("MCSubscription");
$sub = $dl->where($where)->first();
if (!empty($sub) && !empty($delete_record)) {
SS_Log::log(" - Subscriber ID = " . $sub->ID . " Deleted!", SS_Log::NOTICE);
$sub->setSyncMailChimp(false);
$sub->delete();
} else {
if (!empty($sub)) {
SS_Log::log(" - Subscriber ID = " . $sub->ID, SS_Log::NOTICE);
$reason = isset($member['reason_text']) && !empty($member['reason_text']) ? $member['reason_text'] : $member['reason'];
$sub->setField('Subscribed', 0);
$sub->setField('UnsubscribeReason', $reason);
$sub->setSyncMailChimp(false);
$sub->write();
} else {
SS_Log::log("Member In MailChimp List (" . $list->Name . ") and marked as unsubscribed but has no related MCSubscription object! Perhaps The Subscription Record Was Deleted On The Site Rather Than Just Unsubscribed and the Sync is only just catching up?", SS_Log::WARN);
}
}
}
// END foreach($retval['data] as $member) {
}
// END if($retval['total] > 0) {
}
// END listMemberInfo() -> if($api->errorCode) {} else {
// Assume Success If We Havn't Already Returned False By This Point
return true;
}
示例13: addUserToList
function addUserToList($user_id, $product_id)
{
require_once JPATH_COMPONENT . '/helpers/MCAPI.class.php';
$db = JFactory::getDBO();
$sql = "select p.mailchimpapi, p.mailchimplist, p.mailchimpregister, p.mailchimpgroupid, u.email, c.firstname, c.lastname from #__users u, #__digicom_products p, #__digicom_customers c where u.id=c.id and u.id=" . intval($user_id) . " and p.id=" . intval($product_id);
$db->setQuery($sql);
$db->query();
$result = $db->loadAssocList();
if (isset($result) && count($result) > 0) {
$mc_username = $result["0"]["mailchimpapi"];
$mc_listid = $result["0"]["mailchimplist"];
$mc_autoregister = $result["0"]["mailchimpregister"] == 0 ? FALSE : TRUE;
$mc_groupid = $result["0"]["mailchimpgroupid"];
$mc_email = $result["0"]["email"];
if (trim($mc_username) == "") {
$sql = "select `mailchimpapi` from #__digicom_settings";
$db->setQuery($sql);
$db->query();
$mc_username = $db->loadResult();
}
if (trim($mc_listid) == "") {
$sql = "select `mailchimplist` from #__digicom_settings";
$db->setQuery($sql);
$db->query();
$mc_listid = $db->loadResult();
}
if (trim($mc_username) != "" && trim($mc_listid) != "") {
$api = new MCAPI($mc_username);
$user_info = $api->listMemberInfo($mc_listid, $mc_email);
if ($user_info === FALSE) {
//add new user
$mergeVars = array('FNAME' => $result["0"]["firstname"], 'LNAME' => $result["0"]["lastname"]);
if (trim($mc_groupid) != "") {
$mergeVars["INTERESTS"] = trim($mc_groupid);
}
$api->listSubscribe($mc_listid, $mc_email, $mergeVars, 'html', $mc_autoregister, true);
} else {
//already exist and update user group
if (trim($mc_groupid) != "") {
$user_group_string = $user_info["merges"]["INTERESTS"];
$user_group_array = explode(",", $user_group_string);
$exist = FALSE;
foreach ($user_group_array as $key => $group) {
if (trim($group) == trim($mc_groupid)) {
$exist = TRUE;
}
}
if ($exist === FALSE) {
$new_group_list = trim($user_group_string);
if (trim($new_group_list) != "") {
$new_group_list = trim($user_group_string) . ", " . trim($mc_groupid);
} else {
$new_group_list = trim($mc_groupid);
}
$mergeVars = array('INTERESTS' => $new_group_list);
$name = "";
$groups = $api->listInterestGroupings($mc_listid);
if (isset($groups) && count($groups) > 0) {
foreach ($groups as $key_group => $group) {
if (isset($group["groups"]) && count($group["groups"]) > 0) {
foreach ($group["groups"] as $key_subgroup => $subgroup) {
if (trim($subgroup["name"]) == trim($mc_groupid)) {
$name = $group["name"];
break;
}
}
}
}
}
if (trim($name) != "") {
$mergeVars = array('INTERESTS' => $new_group_list, 'GROUPINGS' => array(array('name' => $name, 'groups' => $new_group_list)));
}
$api->listUpdateMember($mc_listid, $mc_email, $mergeVars, 'html', false);
}
}
}
}
}
}