Skip to content

Commit

Permalink
Bump to new version 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
debba committed Dec 1, 2023
1 parent 1a2067e commit 50c9463
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 3 deletions.
6 changes: 5 additions & 1 deletion .wordpress-org/readme/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion admin/class-emailchef-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Binary file added admin/img/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion emailchef.php
Original file line number Diff line number Diff line change
Expand Up @@ -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+
Expand Down
15 changes: 15 additions & 0 deletions includes/drivers/forms/class-emailchef-drivers-forms-abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
9 changes: 9 additions & 0 deletions lib/emailchef/src/Command/Api/CreateContactCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
),
Expand Down

0 comments on commit 50c9463

Please sign in to comment.