From 50c9463db7bf617ec1cd2c3751852fabe11b08b2 Mon Sep 17 00:00:00 2001 From: Andrea Debernardi Date: Fri, 1 Dec 2023 16:08:20 +0100 Subject: [PATCH] Bump to new version 2.7 --- .wordpress-org/readme/README.md | 6 +++++- admin/class-emailchef-admin.php | 2 +- admin/img/icon.png | Bin 0 -> 353 bytes emailchef.php | 2 +- .../class-emailchef-drivers-forms-abstract.php | 15 +++++++++++++++ .../src/Command/Api/CreateContactCommand.php | 9 +++++++++ 6 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 admin/img/icon.png 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 0000000000000000000000000000000000000000..710a96507d8a7b6b42dcf09f32bacd6f8a04fb15 GIT binary patch literal 353 zcmV-n0iOPeP)G@^cB)aXi4u$o*<9V^a*N@$))zSeY?(V4>}YCfq`j`F=)0jj915TymoD`1>IrXU`#NK4sRDt9{w00 ze2?kr2-FrCe4tUn1_;xsZ*ac&He|4Eu6>CX{VQP7v=3KGYer;PmUR}GBncEn!3NJX z^Ei&dw(XPPD2gD@bI>%+rC(UkScLe7_4@N)SO~#&Wm$&!IXgTg*L@LnT@OstgyHZO zbY1@iR#gR?%@?0e8jl~DJv0$v>II}}3cl|%pu)5#VO8oBLb=%QcMMRbSgn?v6=mua zq;j=_0MGM|wIb}gL3ZgokfP&8Cvxv{@gu+hN_2QN#`4j_00000NkvXXu0mjfTpyT~ literal 0 HcmV?d00001 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, ),