diff --git a/.wordpress-org/readme/README.md b/.wordpress-org/readme/README.md index 3aafb68..fe31646 100644 --- a/.wordpress-org/readme/README.md +++ b/.wordpress-org/readme/README.md @@ -4,7 +4,7 @@ Donate link: https://www.dueclic.com Tags: Emailchef, newsletter, email, marketing, automation, form, forms Requires at least: 5.0 Tested up to: 6.4.1 -Stable tag: 2.6 +Stable tag: 2.7 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -42,6 +42,10 @@ Register for free in Emailchef and get your free trial period. Higher plans can == Changelog == += 2.7 = +* privacy, terms and newsletter fields - sync fixes +* added new icon in admin menu + = 2.6 = * bugfixes diff --git a/admin/class-emailchef-admin.php b/admin/class-emailchef-admin.php index 82f9d75..3f888be 100644 --- a/admin/class-emailchef-admin.php +++ b/admin/class-emailchef-admin.php @@ -85,7 +85,7 @@ public function menu() { add_menu_page( 'emailchef', 'Emailchef', 'manage_options', 'emailchef', array( $this, 'page_forms', - ), 'dashicons-email-alt', 50 ); + ), plugin_dir_url( __FILE__ ) . 'img/icon.png', 50 ); add_submenu_page( 'emailchef', 'Emailchef Forms', __( 'Forms', 'emailchef' ), 'manage_options', 'emailchef', array( $this, diff --git a/admin/img/icon.png b/admin/img/icon.png new file mode 100644 index 0000000..710a965 Binary files /dev/null and b/admin/img/icon.png differ diff --git a/emailchef.php b/emailchef.php index 6fc6f66..9d995d7 100644 --- a/emailchef.php +++ b/emailchef.php @@ -8,7 +8,7 @@ * Plugin Name: Emailchef * Plugin URI: http://emailchef.com/ * Description: Emailchef: The simplest recipe to cook amazing newsletters. Automatically synchronize form submissions from Contact Form 7, FSCF and Jetpack. - * Version: 2.6 + * Version: 2.7 * Author: dueclic * Author URI: https://www.dueclic.com * License: GPL-2.0+ diff --git a/includes/drivers/forms/class-emailchef-drivers-forms-abstract.php b/includes/drivers/forms/class-emailchef-drivers-forms-abstract.php index 19d1938..a0e7a1e 100644 --- a/includes/drivers/forms/class-emailchef-drivers-forms-abstract.php +++ b/includes/drivers/forms/class-emailchef-drivers-forms-abstract.php @@ -121,18 +121,33 @@ public function sendSubmission($id, $data) $listId = $form['listId']; $map = $form['field']; + $mappingEmail = false; $toSend = array(); foreach ($map as $key => $value) { if (!isset($data[$key]) || empty($value)) { continue; } + + if ($value === "privacy_accepted"){ + $value = "privacy"; + } + + if ($value === "terms_accepted"){ + $value = "terms"; + } + + if ($value === "newsletter_accepted"){ + $value = "newsletter"; + } + $toSend[$value] = $data[$key]; if ($value == 'email') { $mappingEmail = true; } } + if (!$mappingEmail) { return; // nothing mapping to email } diff --git a/lib/emailchef/src/Command/Api/CreateContactCommand.php b/lib/emailchef/src/Command/Api/CreateContactCommand.php index f19857c..d8920e5 100644 --- a/lib/emailchef/src/Command/Api/CreateContactCommand.php +++ b/lib/emailchef/src/Command/Api/CreateContactCommand.php @@ -19,10 +19,16 @@ public function execute($listId, $toSend, $authKey) $email = isset($toSend['email']) ? $toSend['email'] : ''; $first_name = isset($toSend['first_name']) ? $toSend['first_name'] : ''; $last_name = isset($toSend['last_name']) ? $toSend['last_name'] : ''; + $privacy = isset($toSend['privacy']) ? (int)$toSend['privacy'] : 0; + $terms = isset($toSend['terms']) ? (int)$toSend['terms'] : 0; + $newsletter = isset($toSend['newsletter']) ? (int)$toSend['newsletter'] : 0; unset($toSend['email']); unset($toSend['first_name']); unset($toSend['last_name']); + unset($toSend['privacy']); + unset($toSend['terms']); + unset($toSend['newsletter']); $data = array( 'instance_in' => array( @@ -31,6 +37,9 @@ public function execute($listId, $toSend, $authKey) 'mode' => 'SINGLE_OPT_IN', 'firstname' => $first_name, 'lastname' => $last_name, + 'privacy' => $privacy, + 'terms' => $terms, + 'newsletter' => $newsletter, 'status' => 'ACTIVE', 'custom_fields' => $toSend, ),