Skip to content

Commit e730f93

Browse files
authored
Merge pull request #59 from WebDevStudios/release110
Version 1.1.0 release
2 parents f3357f3 + a9d26d1 commit e730f93

File tree

6 files changed

+119
-9
lines changed

6 files changed

+119
-9
lines changed

README.txt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
Contributors: constantcontact, znowebdev, jmichaelward, webdevstudios
33
Tags: capture, contacts, constant contact, constant contact form, constant contact newsletter, constant contact official, contact forms, email, form, forms, marketing, mobile, newsletter, opt-in, plugin, signup, subscribe, subscription, widget
44
Requires at least: 5.2.2
5-
Tested up to: 5.2.2
6-
Stable tag: 1.0.2
5+
Tested up to: 5.2.3
6+
Stable tag: 1.1.0
77
Requires PHP: 7.2
88
WC tested up to: 3.5.6
99
License: GPLv3
@@ -20,7 +20,6 @@ and send targeted emails that engage your customers on every device.
2020

2121
Unleash the power of your business—and drive more revenue—by integrating Constant Contact with WooCommerce today.
2222

23-
2423
With Constant Contact you can:
2524
- Drag and drop products from your store into any email and customize the details.
2625
- Automatically import WooCommere contacts into your Constant Contact account.
@@ -33,3 +32,11 @@ With Constant Contact you can:
3332
--- Prospects: Have not made a purchase yet
3433
- Send automated welcome emails and behavior based trigger emails
3534
- Find new customers with Facebook and Instagram ads
35+
36+
== Changelog ==
37+
38+
= 1.1.0 =
39+
40+
* Added: Campaign ID data inclusion for purchased orders originating from your mailing campaigns.
41+
* Fixed: compatibility issue with phone numbers and PHP 7.3
42+
* Updated: Wording in our WooCommerce tab.

plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Plugin Name: Constant Contact + WooCommerce
1111
* Description: Add products to your emails and sync your contacts.
1212
* Plugin URI: https://github.com/WebDevStudios/constant-contact-woocommerce
13-
* Version: 1.0.2
13+
* Version: 1.1.0
1414
* Author: Constant Contact
1515
* Author URI: https://www.constantcontact.com/
1616
* Text Domain: cc-woo

src/View/Admin/Field/ImportHistoricalData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ImportHistoricalData {
3333
*/
3434
public function get_form_field() : array {
3535
return [
36-
'title' => esc_html__( 'Import historical customer data', 'cc-woo' ),
36+
'title' => esc_html__( 'Import your contacts', 'cc-woo' ),
3737
'desc' => $this->get_description(),
3838
'type' => 'select',
3939
'id' => self::OPTION_FIELD_NAME,

src/View/Admin/WooTab.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function register_hooks() {
186186
public function get_sections() {
187187
$sections = [
188188
'' => esc_html__( 'Store Information', 'cc-woo' ),
189-
$this->import_existing_customer_section => esc_html__( 'Importing Existing Customers', 'cc-woo' )
189+
$this->import_existing_customer_section => esc_html__( 'Import your contacts', 'cc-woo' )
190190
];
191191

192192
return apply_filters( 'woocommerce_get_sections_' . $this->id, $sections );
@@ -489,14 +489,14 @@ private function get_store_information_settings() {
489489
private function get_customer_data_settings() {
490490
$settings = [
491491
[
492-
'title' => esc_html__( 'Importing Existing Customers', 'cc-woo' ),
492+
'title' => esc_html__( 'Import your contacts', 'cc-woo' ),
493493
'id' => 'cc_woo_customer_data_settings',
494494
'type' => 'title',
495495
],
496496
[
497497
'title' => '',
498498
'type' => 'title',
499-
'desc' => esc_html__( 'All contacts must agree to receive marketing messages in order to be added to your mailing list. Therefore, when you import contacts, you are agreeing that you have permission to send them marketing messages.', 'cc-woo' ),
499+
'desc' => esc_html__( "Start marketing to your customers right away by importing all your contacts now.\n\nDo you want to import your current contacts? By selecting yes below, you agree you have permission to market to your current contacts.", 'cc-woo' ),
500500
]
501501
];
502502

@@ -560,6 +560,16 @@ public function add_cc_connection_button() {
560560
<button class="button button-primary" type="submit" name="cc_woo_action" value="<?php echo esc_attr( $value ); ?>">
561561
<?php echo esc_html( $message ); ?>
562562
</button>
563+
<span style="line-height:28px; margin-left:25px;">
564+
<?php
565+
printf(
566+
/* translators: the placeholders hold opening and closing `<a>` tags. */
567+
esc_html__( 'If you have any issues connecting please call %1$sConstant Contact Support%2$s', 'cc-woo' ),
568+
'<a href="https://community.constantcontact.com/contact-support">',
569+
'</a>'
570+
);
571+
?>
572+
</span>
563573
</div>
564574
<?php
565575
}
@@ -712,7 +722,7 @@ private function validate_value( $field ) {
712722
* @return string
713723
*/
714724
public function sanitize_phone_number( $value ) {
715-
return is_scalar( $value ) ? preg_replace( '/[^\d-()+]+/', '', $value ) : '';
725+
return is_scalar( $value ) ? preg_replace( '/[^\d\-()+]+/', '', $value ) : '';
716726
}
717727

718728
/**

src/View/Checkout/CampaignId.php

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?php
2+
/**
3+
* Class to handle filtering fields in the checkout billing form.
4+
*
5+
* @see https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/
6+
* @author Michael Beckwith <[email protected]>
7+
* @package WebDevStudios\CCForWoo\View\Checkout
8+
* @since 2019-08-22
9+
*/
10+
11+
namespace WebDevStudios\CCForWoo\View\Checkout;
12+
13+
use WebDevStudios\OopsWP\Utility\Hookable;
14+
15+
/**
16+
* Class CampaignId
17+
*
18+
* @author Michael Beckwith <[email protected]>
19+
* @package WebDevStudios\CCForWoo\View\Checkout
20+
* @since 2019-08-22
21+
*/
22+
class CampaignId implements Hookable {
23+
/**
24+
* The name of the meta field for the customer's preference.
25+
* This constant will be used both in usermeta (for users) and postmeta (for orders).
26+
*
27+
* @var string
28+
* @since 2019-08-22
29+
*/
30+
const CUSTOMER_CAMPAIGN_ID_KEY = 'campaign_activity_id';
31+
32+
/**
33+
* Register actions and filters with WordPress.
34+
*
35+
* @author Michael Beckwith <[email protected]>
36+
* @since 2019-08-22
37+
*/
38+
public function register_hooks() {
39+
add_action( 'init', [ $this, 'save_campaign_id' ], 11 );
40+
add_action( 'woocommerce_checkout_update_order_meta', [ $this, 'save_user_campaign_id_to_order' ] );
41+
}
42+
43+
/**
44+
* Save the user preference to the order meta.
45+
*
46+
* @param int $order_id The order ID.
47+
*
48+
* @author Michael Beckwith <[email protected]>
49+
* @since 2019-08-22
50+
* @return void
51+
*/
52+
public function save_user_campaign_id_to_order( $order_id ) {
53+
$preference = $this->get_stored_campaign_id();
54+
55+
if ( empty( $preference ) ) {
56+
return;
57+
}
58+
59+
add_post_meta( $order_id, self::CUSTOMER_CAMPAIGN_ID_KEY, $preference, true );
60+
}
61+
62+
/**
63+
* Save the campaign ID for the session.
64+
*
65+
* @throws \Exception DateTime exception.
66+
*
67+
* @author Michael Beckwith <[email protected]>
68+
* @since 2019-08-22
69+
* @return void
70+
*/
71+
public function save_campaign_id() {
72+
$campaign_id = filter_input( INPUT_GET, 'source', FILTER_SANITIZE_STRING );
73+
74+
if ( ! empty( $campaign_id ) ) {
75+
setcookie( 'ctct_woo_campaign_id', $campaign_id, 0, '/' );
76+
}
77+
}
78+
79+
/**
80+
* Get the submitted customer newsletter preference.
81+
*
82+
* @author Michael Beckwith <[email protected]>
83+
* @since 2019-08-22
84+
* @return string
85+
*/
86+
private function get_stored_campaign_id() {
87+
return isset( $_COOKIE['ctct_woo_campaign_id'] )
88+
? sanitize_text_field( $_COOKIE['ctct_woo_campaign_id'] )
89+
: '';
90+
}
91+
}

src/View/ViewRegistrar.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace WebDevStudios\CCForWoo\View;
1111

1212
use WebDevStudios\CCForWoo\View\Admin\WooTab;
13+
use WebDevStudios\CCForWoo\View\Checkout\CampaignId;
1314
use WebDevStudios\CCForWoo\View\Checkout\NewsletterPreferenceCheckbox;
1415
use WebDevStudios\OopsWP\Structure\Service;
1516

@@ -35,6 +36,7 @@ class ViewRegistrar extends Service {
3536
*/
3637
protected $forms = [
3738
NewsletterPreferenceCheckbox::class,
39+
CampaignId::class,
3840
];
3941

4042

0 commit comments

Comments
 (0)