Will
unread,Jun 7, 2010, 4:52:16 PM6/7/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to MailChimp API Discuss
Ok. The place were I set the Segments (and where I schedule campaigns
too by the way) are totally different than the place where I modified
the common fields of the campaign such as from_name, from_email,
subject, etc.
Just to be sure, I search my whole code looking for segment_opts and
campaign_update... and the logic is pretty simple.
I'm affraid the problem is not in my end.
In fact... See very solution I gave it, tells me that the problem is
in Mailchimp servers. Here's the code (with my "solution" with
asterisks prefixed. There were not there initially):
As you can see, there's no way to update segment_opts with a blank
field.
$options = array(
'list_id' => $lid,
'subject' => $subject,
'from_email' => $from_email,
'from_name' => $from_name,
'to_email' => '$to_email,
'tracking' => array(
'opens' => ($track_opens?true:false),
'html_clicks' => ($track_clicks?true:false),
'text_clicks' => ($track_texto?true:false)
),
'title' => $title,
'authenticate' => ($authenticate?true:false),
'auto_footer' => false,
'inline_css' => false,
'generate_text' => false
);
if ( $cid != 0) {
*** $c = tcm_get_campaign($cid);
$error_lines = '';
foreach ($options as $key => $option) {
if ( !$api->campaignUpdate( $cid, $key,$option ) ) {
if ( $error_lines != '' ) {
$error_lines .= ', ';
}
$error_lines .= $api->errorMessage;
}
}
if ( !$api->campaignUpdate( $cid, 'content', $content ) ) {
if ( $error_lines != '' ) {
$error_lines .= ', ';
}
$error_lines .= $api->errorMessage;
}
*** $api->campaignUpdate( $cid, 'segment_opts',
$c['segment_opts'] );
} else { // creating a new campaign
All best,
Will