Skip to content

Commit

Permalink
Fixed issue with custom fields not being set
Browse files Browse the repository at this point in the history
  • Loading branch information
mediabeastnz committed Jan 26, 2017
1 parent f7c3f39 commit 8acb7a3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions code/extensions/EditableCampaignMonitorField.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,14 @@ public function getValueFromData($data)
$auth = array(null, 'api_key' => $this->config()->get('api_key'));
$wrap = new CS_REST_Subscribers($this->owner->getField('ListID'), $auth);

$custom_fields = $this->addCustomFields($data);
$custom_fields = $this->getCustomFields($data);
if (empty($custom_fields)) { $custom_fields = array(); }

$dataToSend = array(
'EmailAddress' => $data[$this->owner->getField('EmailField')],
'Name' => $data[$this->owner->getField('FirstNameField')].' '.$data[$this->owner->getField('LastNameField')],
'Resubscribe' => true,
'CustomFields' => $custom_fields[0]
'CustomFields' => $custom_fields
);

$result = $wrap->add($dataToSend);
Expand Down Expand Up @@ -238,7 +238,7 @@ public function getLists()
/**
* @return Array
*/
public function addCustomFields(Array $data)
public function getCustomFields(Array $data)
{
$custom_fields = array();
// loop through the submitted data and check for custom fields
Expand Down

0 comments on commit 8acb7a3

Please sign in to comment.