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.0.10
Browse files Browse the repository at this point in the history
1. Fix issue where campaign would be created in wrong CRM account if API key was specified in post meta
  • Loading branch information
Aaron Huisinga committed May 20, 2017
1 parent 061e9cd commit e122de8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions chiro-quiz.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
* Plugin Name: Chiropractic Quiz
* Version: 1.0.9
* Version: 1.0.10
* Plugin URI: https://platform.marketing/
* Description: Simple chiropractic lead generation through a quiz that helps qualify prospective patients.
* Author: Platform Marketing
Expand All @@ -20,7 +20,7 @@
define( 'CHIRO_QUIZ_PLUGIN_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) );

if ( ! defined( 'CHIRO_QUIZ_PLUGIN_VERSION' ) )
define( 'CHIRO_QUIZ_PLUGIN_VERSION', '1.0.9' );
define( 'CHIRO_QUIZ_PLUGIN_VERSION', '1.0.10' );

require_once( 'classes/class-chiro-quiz.php' );

Expand Down
11 changes: 8 additions & 3 deletions classes/class-chiro-quiz.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function __construct($file)
], 10, 1);
add_filter('enter_title_here', [$this, 'change_default_title']);
// Create FrontDesk Campaigns for pages
add_action('publish_pf_chiro_quiz', [$this, 'create_frontdesk_campaign']);
add_action('publish_pf_chiro_quiz', [$this, 'create_frontdesk_campaign'], 10, 2);
}

// Flush rewrite rules on plugin activation
Expand Down Expand Up @@ -590,6 +590,10 @@ public function create_frontdesk_campaign($post_ID)

global $wpdb;
$permalink = get_permalink($post_ID);
$api_key = get_post_meta($post_ID, 'api_key', true);
if ($api_key == '') {
$api_key = $_POST['api_key'];
}

// See if we're using domain mapping
$wpdb->dmtable = $wpdb->base_prefix . 'domain_mapping';
Expand All @@ -607,14 +611,15 @@ public function create_frontdesk_campaign($post_ID)

if (($_POST['post_status'] != 'publish') || ($_POST['original_post_status'] == 'publish')) {
$campaign_id = get_post_meta($post_ID, 'frontdesk_campaign', true);

if ($campaign_id != '' && is_int($campaign_id)) {
$this->frontdesk->setApiKey(get_post_meta($post_ID, 'api_key', true))
$this->frontdesk->setApiKey($api_key)
->updateCampaign($campaign_id, get_the_title($post_ID), $permalink);
}

return true;
}
$campaign_id = $this->frontdesk->setApiKey(get_post_meta($post_ID, 'api_key', true))
$campaign_id = $this->frontdesk->setApiKey($api_key)
->createCampaign(get_the_title($post_ID), $permalink);
if (is_int($campaign_id)) {
update_post_meta($post_ID, 'frontdesk_campaign', $campaign_id);
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: chiropractic, platform, chiro quiz
Requires at least: 4.0
Tested up to: 4.7.4
Stable tag: 1.0.9
Stable tag: 1.0.10

Simple chiropractic lead generation through a quiz that helps qualify prospective patients.

Expand Down

0 comments on commit e122de8

Please sign in to comment.