Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
Bump to version 1.6.3
Browse files Browse the repository at this point in the history
1. Update Platform CRM API to v3
  • Loading branch information
aaronhuisinga committed Nov 29, 2019
1 parent a485dfc commit 22d9744
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 19 deletions.
40 changes: 25 additions & 15 deletions classes/class-platform-crm.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class PlatformCRM
*
* @param int $api_version
*/
public function __construct($api_version = 2)
public function __construct($api_version = 3)
{
$this->token = 'pf_program_page';
$this->api_key = get_option('pf_program_page_frontdesk_key');
Expand Down Expand Up @@ -54,13 +54,15 @@ public function createCampaign($title, $permalink)
if ($this->api_key != null || $this->api_key != '') {
$response = $this->guzzle->post($this->api_base . 'campaigns/', [
'form_params' => [
'key' => $this->api_key,
'title' => $title,
'description' => 'Campaign for Platform Program Page Funnel',
'type' => 'Platform',
'total_cost' => '10000',
'source' => $permalink
]
],
'headers' => [
'Authorization' => 'Bearer ' . $this->api_key,
],
]);

add_filter('redirect_post_location', [$this, 'add_success_var'], 99);
Expand All @@ -85,10 +87,12 @@ public function updateCampaign($id, $title, $permalink)
if ($this->api_key != null || $this->api_key != '') {
$this->guzzle->patch($this->api_base . 'campaigns/' . $id, [
'form_params' => [
'key' => $this->api_key,
'title' => $title,
'source' => $permalink
]
],
'headers' => [
'Authorization' => 'Bearer ' . $this->api_key,
],
]);
}
}
Expand All @@ -105,13 +109,15 @@ public function createProspect($data)
{
try {
if ($this->api_key != null || $this->api_key != '') {
$response = $this->guzzle->post($this->api_base . 'subscribers/complete', [
$response = $this->guzzle->post($this->api_base . 'subscribers', [
'form_params' => [
'key' => $this->api_key,
'campaigns' => $data['campaign_id'],
'email' => $data['email'],
'first_name' => $data['first_name']
]
'campaigns' => $data['campaign_id'],
'email' => $data['email'],
'first_name' => $data['first_name']
],
'headers' => [
'Authorization' => 'Bearer ' . $this->api_key,
],
]);

return json_decode($response->getBody(), true)['data']['id'];
Expand All @@ -138,7 +144,6 @@ public function updateProspect($id, $data)
if ($this->api_key != null || $this->api_key != '') {
$response = $this->guzzle->patch($this->api_base . 'subscribers/' . $id, [
'form_params' => [
'key' => $this->api_key,
'email' => $data['email'],
'last_name' => $data['last_name'],
'address' => $data['address'],
Expand All @@ -147,7 +152,10 @@ public function updateProspect($id, $data)
'state' => $data['state'],
'zip_code' => $data['zip_code'],
'phone' => $data['phone']
]
],
'headers' => [
'Authorization' => 'Bearer ' . $this->api_key,
],
]);

return json_decode($response->getBody(), true)['data']['id'];
Expand All @@ -174,11 +182,13 @@ public function createNote($id, $title, $content)
if ($this->api_key != null || $this->api_key != '') {
$response = $this->guzzle->post($this->api_base . 'subscribers/notes/', [
'form_params' => [
'key' => $this->api_key,
'subscriber_id' => $id,
'title' => $title,
'content' => $content
]
],
'headers' => [
'Authorization' => 'Bearer ' . $this->api_key,
],
]);

return json_decode($response->getBody(), true)['data']['id'];
Expand Down
2 changes: 1 addition & 1 deletion classes/class-program-page-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public function frontdesk_key_field()
$data = $option;

echo '<input id="frontdesk_key" type="text" name="' . $this->token . '_frontdesk_key" value="' . $data . '"/>
<label for="frontdesk_key"><span class="description">' . __('Enter your API key generated by Platform CRM. To access your API key, visit <a href="https://platformcrm.com/account/api" target="_blank">https://platformcrm.com/account/api</a>.', $this->token) . '</span></label>';
<label for="frontdesk_key"><span class="description">' . __('Enter your API key generated by Platform CRM. To access your API key, visit <a href="https://platformcrm.com" target="_blank">https://platformcrm.com</a>.', $this->token) . '</span></label>';

}

Expand Down
4 changes: 2 additions & 2 deletions program-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

/*
* Plugin Name: Program Page
* Version: 1.6.2
* Version: 1.6.3
* Plugin URI: http://www.coldturkeygroup.com/
* Description: Custom info pages for Platform ad campaigns
* Author: Cold Turkey Group
Expand All @@ -26,7 +26,7 @@
}

if (!defined('PROGRAM_PAGE_PLUGIN_VERSION')) {
define('PROGRAM_PAGE_PLUGIN_VERSION', '1.6.2');
define('PROGRAM_PAGE_PLUGIN_VERSION', '1.6.3');
}

require_once('classes/class-program-page.php');
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: Aaron Huisinga
Tags: real estate, platform, days on market
Requires at least: 3.5
Tested up to: 5.1
Stable tag: 1.6.2
Stable tag: 1.6.3

Custom info pages for Platform ad campaigns (currently supports the HIP, Patriot, PATH, HEROES, BOOST, and First Responder Programs).

Expand Down

0 comments on commit 22d9744

Please sign in to comment.