Skip to content

Commit

Permalink
fix: settings update api supports individual fields
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffersonrabb committed Apr 13, 2020
1 parent 37315d0 commit cd7b18f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions includes/class-newspack-newsletters.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,17 @@ public static function api_set_campaign_settings( $request ) {
);
}

$mc = new Mailchimp( self::mailchimp_api_key() );
$mc = new Mailchimp( self::mailchimp_api_key() );

$settings = [];
if ( $from_name ) {
$settings['from_name'] = $from_name;
}
if ( $reply_to ) {
$settings['reply_to'] = $reply_to;
}
$payload = [
'settings' => [
'from_name' => $from_name,
'reply_to' => $reply_to,
],
'settings' => $settings,
];
$result = $mc->patch( "campaigns/$mc_campaign_id", $payload );

Expand Down

0 comments on commit cd7b18f

Please sign in to comment.