Skip to content

Commit

Permalink
Update - V1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Webtica committed Nov 19, 2021
1 parent b6f8352 commit f21201f
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 7 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ Yes, all the other form widget integrations will be available.

## Changelog

### 1.3.0 - 19-11-2021
* Added Firstname attribute mapping
* Added Lastname attribute mapping
* Tested Elementor up to 3.4.8

### 1.2.0 - 13-11-2021
* Added GDPR checkbox functionality
* Added dynamic tags to the double optin field
Expand Down
52 changes: 48 additions & 4 deletions includes/class-sendinblue-integration-action.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,27 +163,53 @@ public function register_settings_section( $widget ) {
]
);

$widget->add_control(
'sendinblue_name_attribute_field',
[
'label' => __( 'Name Field attribute (Optional)', 'sendinblue-elementor-integration' ),
'type' => \Elementor\Controls_Manager::TEXT,
'placeholder' => 'FIRSTNAME',
'separator' => 'before',
'description' => __( 'Enter the firstname attribute name - you can find this under contact attributes settings in Sendinblue - If this field is not set it wil default to FIRSTNAME', 'sendinblue-elementor-integration' ),
'dynamic' => [
'active' => true,
],
]
);

$widget->add_control(
'sendinblue_name_field',
[
'label' => __( 'Name Field ID (Optional)', 'sendinblue-elementor-integration' ),
'type' => \Elementor\Controls_Manager::TEXT,
'placeholder' => 'name',
'separator' => 'before',
'description' => __( 'Enter the name field id - you can find this under the name field advanced tab', 'sendinblue-elementor-integration' ),
'dynamic' => [
'active' => true,
],
]
);

$widget->add_control(
'sendinblue_last_name_attribute_field',
[
'label' => __( 'Lastname Field attribute (Optional)', 'sendinblue-elementor-integration' ),
'type' => \Elementor\Controls_Manager::TEXT,
'placeholder' => 'LASTNAME',
'separator' => 'before',
'description' => __( 'Enter the lastname attribute name - you can find this under contact attributes settings in Sendinblue - If this field is not set it wil default to LASTNAME', 'sendinblue-elementor-integration' ),
'dynamic' => [
'active' => true,
],
]
);

$widget->add_control(
'sendinblue_last_name_field',
[
'label' => __( 'Lastname Field ID (Optional)', 'sendinblue-elementor-integration' ),
'type' => \Elementor\Controls_Manager::TEXT,
'placeholder' => 'lastname',
'separator' => 'before',
'description' => __( 'Enter the lastname field id - you can find this under the lastname field advanced tab', 'sendinblue-elementor-integration' ),
'dynamic' => [
'active' => true,
Expand Down Expand Up @@ -212,7 +238,9 @@ public function on_export( $element ) {
$element['sendinblue_gdpr_checkbox_field'],
$element['sendinblue_list'],
$element['sendinblue_email_field'],
$element['sendinblue_name_attribute_field'],
$element['sendinblue_name_field'],
$element['sendinblue_last_name_attribute_field'],
$element['sendinblue_last_name_field']
);

Expand Down Expand Up @@ -287,6 +315,22 @@ public function run( $record, $ajax_handler ) {
}
}

// Sendinblue attribute names - Firstname
if (empty($settings['sendinblue_name_attribute_field'])) {
$sendinblueattributename = "FIRSTNAME";
}
else {
$sendinblueattributename = $settings['sendinblue_name_attribute_field'];
}

// Sendinblue attribute names - Lastname
if (empty($settings['sendinblue_last_name_attribute_field'])) {
$sendinblueattributelastname = "LASTNAME";
}
else {
$sendinblueattributelastname = $settings['sendinblue_last_name_attribute_field'];
}

if ($doubleoptin == "yes") {
//Send data to Sendinblue Double optin
$dpubleoptin = wp_remote_post( 'https://api.sendinblue.com/v3/contacts/doubleOptinConfirmation', array(
Expand All @@ -299,7 +343,7 @@ public function run( $record, $ajax_handler ) {
'api-key' => $settings['sendinblue_api'],
'content-Type' => 'application/json',
],
'body' => json_encode(["attributes" => [ "FIRSTNAME" => $fields[$settings['sendinblue_name_field']], "LASTNAME" => $fields[$settings['sendinblue_last_name_field']] ], "includeListIds" => [(int)$settings['sendinblue_list']], "templateId" => (int)$settings['sendinblue_double_optin_template'], "redirectionUrl" => $settings['sendinblue_double_optin_redirect_url'], "email" => $fields[$settings['sendinblue_email_field']]])
'body' => json_encode(["attributes" => [ $sendinblueattributename => $fields[$settings['sendinblue_name_field']], $sendinblueattributelastname => $fields[$settings['sendinblue_last_name_field']] ], "includeListIds" => [(int)$settings['sendinblue_list']], "templateId" => (int)$settings['sendinblue_double_optin_template'], "redirectionUrl" => $settings['sendinblue_double_optin_redirect_url'], "email" => $fields[$settings['sendinblue_email_field']]])
)
);
}
Expand All @@ -315,7 +359,7 @@ public function run( $record, $ajax_handler ) {
'api-key' => $settings['sendinblue_api'],
'content-Type' => 'application/json',
],
'body' => json_encode(["attributes" => [ "FIRSTNAME" => $fields[$settings['sendinblue_name_field']], "LASTNAME" => $fields[$settings['sendinblue_last_name_field']] ], "updateEnabled" => true, "listIds" => [(int)$settings['sendinblue_list']], "email" => $fields[$settings['sendinblue_email_field']]])
'body' => json_encode(["attributes" => [ $sendinblueattributename => $fields[$settings['sendinblue_name_field']], $sendinblueattributelastname => $fields[$settings['sendinblue_last_name_field']] ], "updateEnabled" => true, "listIds" => [(int)$settings['sendinblue_list']], "email" => $fields[$settings['sendinblue_email_field']]])
)
);
}
Expand Down
7 changes: 6 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: sendinblue, elementor, elementor pro, forms, integration, marketing, lists
Requires at least: 5.0
Tested up to: 5.8.2
Requires PHP: 5.4
Stable tag: 1.2.0
Stable tag: 1.3.0
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -51,6 +51,11 @@ Yes, all the other form widget integrations will be available.

== Changelog ==

= 1.3.0 - 2021-11-19 =
* Added Firstname attribute mapping
* Added Lastname attribute mapping
* Tested Elementor up to 3.4.8

= 1.2.0 - 2021-11-13 =
* Added GDPR checkbox functionality
* Added dynamic tags to the double optin field
Expand Down
4 changes: 2 additions & 2 deletions sendinblue-elementor-integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* Description: Easily connect and send data to sendinblue from elementor forms.
* Author: Webtica
* Author URI: https://webtica.be/
* Version: 1.2.0
* Elementor tested up to: 3.4.7
* Version: 1.3.0
* Elementor tested up to: 3.4.8
* Elementor Pro tested up to: 3.5.1
*/

Expand Down

0 comments on commit f21201f

Please sign in to comment.