Skip to content

Commit c4bf8cc

Browse files
authored
Merge pull request #179 from WebDevStudios/release220
Release 2.2.0
2 parents a4a648e + 209b725 commit c4bf8cc

File tree

6 files changed

+156
-25
lines changed

6 files changed

+156
-25
lines changed

README.txt

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
=== Constant Contact + WooCommerce ===
22
Contributors: constantcontact, webdevstudios, znowebdev, jmichaelward, ggwicz, ravedev, newyorkerlaura
3-
Tags: Constant Contact, WooCommerce, eCommerce, email marketing, marketing automation, email, form, forms, marketing, mobile, opt-in, plugin, signup, subscribe, subscription, widget
3+
Tags: Constant Contact, WooCommerce, ecommerce, email marketing, marketing automation, marketing, opt in, abandoned cart
44
Requires at least: 5.2.2
5-
Tested up to: 6.2.2
6-
Stable tag: 2.1.2
5+
Tested up to: 6.3.2
6+
Stable tag: 2.2.0
77
Requires PHP: 7.2
88
License: GPLv3
99

@@ -22,28 +22,16 @@ https://www.youtube.com/watch?v=ZH9G4yhAngk
2222
**With Constant Contact you can:**
2323

2424
* Easily connect WooCommerce to your Constant Contact account and sync contacts automatically.
25-
2625
* Drag and drop a product(s) from your WooCommerce catalog and insert them into your email in seconds.
27-
2826
* Target the right customer/prospect with the right message with predefined segments based on your customers’ purchasing behavior:
29-
30-
31-
* All WooCommerce contacts who opt in to receive email e-marketing
32-
33-
* Recent Customers: Purchased within 30 days
34-
35-
* First-time Customers: Purchased once
36-
37-
* Repeat Customers: Made more than one purchase
38-
39-
* Lapsed Customers: Have not made a purchase in more than 120 days
40-
41-
* Prospects: Have not made a purchase yet
42-
27+
* All WooCommerce contacts who opt in to receive email marketing
28+
* Recent Customers: Purchased within 30 days
29+
* First-time Customers: Purchased once
30+
* Repeat Customers: Made more than one purchase
31+
* Lapsed Customers: Have not made a purchase in more than 120 days
32+
* Prospects: Have not made a purchase yet
4333
* Bring customers back to your online store with automated, targeted emails.
44-
4534
* Find new customers with our social marketing and advertising tools to expand your reach.
46-
4735
* Automatically send a customized branded abandoned cart email to customers who left items in their cart and track resulting revenue.
4836

4937
== Screenshots ==
@@ -83,6 +71,9 @@ You've connected your WooCommerce store to Constant Contact, promoted your WooCo
8371

8472
== Changelog ==
8573

74+
= 2.2.0 =
75+
* Added - Initial support for integration with WordPress Site Health Panel, including connection status, key status, and abandoned cart status.
76+
8677
= 2.1.2 =
8778
* Fixed - `enableStoreDetails` javascript console error.
8879
* Fixed - PHP8 compatibility errors.

composer.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,11 @@
5151
"phpcs.xml.dist",
5252
"tags"
5353
]
54+
},
55+
"config": {
56+
"allow-plugins": {
57+
"composer/installers": true,
58+
"dealerdirect/phpcodesniffer-composer-installer": true
59+
}
5460
}
5561
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "constant-contact-woocommerce",
3-
"version": "2.1.1",
3+
"version": "2.2.0",
44
"description": "",
55
"main": "index.js",
66
"engines": {

plugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
* Plugin Name: Constant Contact + WooCommerce
99
* Description: Add products to your emails and sync your contacts.
1010
* Plugin URI: https://github.com/WebDevStudios/constant-contact-woocommerce
11-
* Version: 2.1.2
11+
* Version: 2.2.0
1212
* Author: Constant Contact
1313
* Author URI: https://www.constantcontact.com/
1414
* Text Domain: constant-contact-woocommerce
1515
* WC requires at least: 3.6.0
16-
* WC tested up to: 6.8.2
16+
* WC tested up to: 8.1.1
1717
* Requires PHP: 7.2
1818
* License: GPL-3.0+
1919
* License URI: https://www.gnu.org/licenses/gpl-3.0.en.html

src/Plugin.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
use Exception;
1313

14+
use WebDevStudios\CCForWoo\Utility\HealthPanel;
1415
use WebDevStudios\CCForWoo\Utility\PluginCompatibilityCheck;
1516
use WebDevStudios\OopsWP\Structure\ServiceRegistrar;
1617
use WebDevStudios\CCForWoo\View\ViewRegistrar;
@@ -47,7 +48,7 @@ final class Plugin extends ServiceRegistrar {
4748
* @since 1.0.0
4849
* @var string
4950
*/
50-
const PLUGIN_VERSION = '2.0.3';
51+
const PLUGIN_VERSION = '2.2.0';
5152

5253
/**
5354
* Whether the plugin is currently active.
@@ -211,6 +212,7 @@ public function register_hooks() {
211212
add_action( 'wp_enqueue_scripts', [ $this, 'register_scripts' ] );
212213
add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_scripts' ], 99 );
213214
add_action( 'init', [ $this, 'load_plugin_textdomain' ] );
215+
add_action( 'init', [ $this, 'load_health_panel' ] );
214216

215217
register_activation_hook( $this->plugin_file, [ $this, 'do_activation_process' ] );
216218
register_deactivation_hook( $this->plugin_file, [ $this, 'do_deactivation_process' ] );
@@ -377,5 +379,9 @@ public function admin_enqueue_scripts() {
377379
public function load_plugin_textdomain() {
378380
load_plugin_textdomain( 'constant-contact-woocommerce' );
379381
}
382+
383+
public function load_health_panel() {
384+
new HealthPanel();
385+
}
380386
}
381387

src/Utility/HealthPanel.php

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
<?php
2+
/**
3+
* Constant Contact + WooCommerce Health Panel
4+
*
5+
* Adds debugging information to the Site Health panel.
6+
*
7+
* @since 2.2.0
8+
* @package cc-woo
9+
*/
10+
11+
namespace WebDevStudios\CCForWoo\Utility;
12+
13+
use WebDevStudios\CCForWoo\Meta\ConnectionStatus;
14+
use WebDevStudios\CCForWoo\Plugin;
15+
use WebDevStudios\CCForWoo\AbandonedCheckouts\CheckoutsTable;
16+
17+
/**
18+
* Class HealthPanel
19+
*
20+
* @package WebDevStudios\CCForWoo\Utility
21+
* @since 2.2.0
22+
*/
23+
class HealthPanel {
24+
25+
public function __construct() {
26+
add_filter( 'debug_information', [ $this, 'health_information' ], 1 );
27+
}
28+
29+
/**
30+
* Callback to add in our own cusotm site health information.
31+
*
32+
* @since 2.2.0
33+
*
34+
* @throws Exception
35+
*
36+
* @param array $debug_info Array of debug info panels.
37+
* @return array
38+
*/
39+
public function health_information( $debug_info ) {
40+
41+
$connection = new ConnectionStatus();
42+
$debug_info['constant-contact-woocommerce'] = [
43+
'label' => esc_html__( 'Constant Contact + WooCommerce', 'constant-contact-woocommerce' ),
44+
'description' => esc_html__( 'Debugging and troubleshooting information for support purposes', 'constant-contact-woocommerce' ),
45+
'fields' => [
46+
[
47+
'label' => esc_html__( 'Plugin version', 'constant-contact-woocommerce' ),
48+
'value' => Plugin::PLUGIN_VERSION,
49+
],
50+
[
51+
'label' => esc_html__( 'Connection status', 'constant-contact-woocommerce' ),
52+
'value' => ( $connection->is_connected() )
53+
? esc_html__( 'Connected', 'constant-contact-woocommerce' )
54+
: esc_html__( 'Disconnected', 'constant-contact-woocommerce' )
55+
],
56+
[
57+
'label' => esc_html__( 'Abandoned checkouts total pending items', 'constant-contact-woocommerce' ),
58+
'value' => $this->abandoned_checkouts_count(),
59+
],
60+
[
61+
'label' => esc_html__( 'Abandoned checkouts expiration cron status', 'constant-contact-woocommerce' ),
62+
'value' => ( wp_next_scheduled( 'cc_woo_check_expired_checkouts' ) )
63+
? esc_html__( 'Scheduled', 'constant-contact-woocommerce' )
64+
: esc_html__( 'Not scheduled', 'constant-contact-woocommerce' ),
65+
],
66+
[
67+
'label' => esc_html__( 'Current user has a CC key', 'constant-contact-woocommerce' ),
68+
'value' => ( $this->user_has_cc_key() )
69+
? esc_html__( 'True', 'constant-contact-woocommerce' )
70+
: esc_html__( 'False', 'constant-contact-woocommerce' ),
71+
],
72+
]
73+
];
74+
75+
return $debug_info;
76+
}
77+
78+
/**
79+
* Check if the current user has a Constant Contact API key.
80+
*
81+
* @since 2.2.0
82+
*
83+
* @return bool
84+
*/
85+
private function user_has_cc_key(): bool {
86+
$user_id = get_current_user_id();
87+
88+
if ( ! $user_id ) {
89+
return false;
90+
}
91+
92+
$query = <<<SQL
93+
SELECT
94+
key_id
95+
FROM
96+
{$GLOBALS['wpdb']->prefix}woocommerce_api_keys
97+
WHERE
98+
user_id = %d
99+
AND
100+
(
101+
description LIKE '%Constant Contact%'
102+
OR
103+
description LIKE '%ConstantContact%'
104+
)
105+
SQL;
106+
107+
return ! empty( $GLOBALS['wpdb']->get_col( $GLOBALS['wpdb']->prepare( $query, $user_id ) ) );
108+
}
109+
110+
/**
111+
* Returns a count of total abandoned checkouts.
112+
*
113+
* @since 2.2.0
114+
*
115+
* @return string
116+
*/
117+
private function abandoned_checkouts_count() : string {
118+
$table = CheckoutsTable::get_table_name();
119+
$query = <<<SQL
120+
SELECT
121+
count(*)
122+
FROM
123+
{$table}
124+
SQL;
125+
$count = (string) $GLOBALS['wpdb']->get_var( $query );
126+
return ( ! empty( $count ) ) ? $count : '0';
127+
}
128+
}

0 commit comments

Comments
 (0)