SendinBlue Subscribe Form And WP SMTP - Version 3.1.15

Version Description

Improvements

  • Fixed some minor issues related to double optin subscription
  • Removed legacy code corresponding double optin subscription
Download this release

Release Info

Developer amarsib
Plugin Icon 128x128 SendinBlue Subscribe Form And WP SMTP
Version 3.1.15
Comparing to
See all releases

Code changes from version 3.1.14 to 3.1.15

inc/SendinblueApiClient.php CHANGED
@@ -14,7 +14,7 @@ class SendinblueApiClient
14
  const RESPONSE_CODE_CREATED = 201;
15
  const RESPONSE_CODE_ACCEPTED = 202;
16
  const RESPONSE_CODE_UNAUTHORIZED = 401;
17
- const PLUGIN_VERSION = '3.1.14';
18
  const USER_AGENT = 'sendinblue_plugins/wordpress';
19
 
20
  private $apiKey;
14
  const RESPONSE_CODE_CREATED = 201;
15
  const RESPONSE_CODE_ACCEPTED = 202;
16
  const RESPONSE_CODE_UNAUTHORIZED = 401;
17
+ const PLUGIN_VERSION = '3.1.15';
18
  const USER_AGENT = 'sendinblue_plugins/wordpress';
19
 
20
  private $apiKey;
inc/sib-api-manager.php CHANGED
@@ -167,8 +167,6 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
167
  if (!empty($list_data['lists'])) {
168
  foreach ( $list_data['lists'] as $value ) {
169
  if ( 'Temp - DOUBLE OPTIN' == $value['name'] ) {
170
- $tempList = $value['id'];
171
- update_option( SIB_Manager::TEMPLIST_OPTION_NAME, $tempList );
172
  continue;
173
  }
174
  $lists[] = array(
@@ -177,9 +175,10 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
177
  );
178
  }
179
  }
180
- }
181
- if ( count( $lists ) > 0 ) {
182
- set_transient( 'sib_list_' . md5( SIB_Manager::$access_key ), $lists, self::DELAYTIME );
 
183
  }
184
  return $lists;
185
  }
@@ -302,12 +301,10 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
302
 
303
  $isDopted = false;
304
 
305
- $temp_dopt_list = get_option( SIB_Manager::TEMPLIST_OPTION_NAME );
306
-
307
  $desired_lists = $list_id;
308
 
309
  if ( 'double-optin' == $type ) {
310
- $list_id = array( $temp_dopt_list );
311
  }
312
 
313
  // new user.
@@ -336,10 +333,6 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
336
  if ( isset( $attrs['DOUBLE_OPT-IN'] ) && '1' == $attrs['DOUBLE_OPT-IN'] ) {
337
  $isDopted = true;
338
  }
339
- // remove dopt temp list from $listid.
340
- if (($key = array_search($temp_dopt_list, $listid)) !== false) {
341
- unset($listid[$key]);
342
- }
343
 
344
  $diff = array_diff( $desired_lists, $listid );
345
  if ( ! empty( $diff ) ) {
@@ -347,9 +340,6 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
347
  if ( 'double-optin' != $type ) {
348
  $listid = array_unique( array_merge( $listid, $list_id ) );
349
  }
350
- if ( ( 'double-optin' == $type && ! $isDopted) ) {
351
- array_push( $listid, $temp_dopt_list );
352
- }
353
  } else {
354
  if ( '1' == $res['emailBlacklisted'] ) {
355
  $status = 'update';
@@ -708,19 +698,14 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
708
  {
709
  SIB_API_Manager::send_comfirm_email( 'confirm', $email, $current_form['confirmID'], $info );
710
  }
711
- // temp dopt list.
712
- $temp_list = get_option( SIB_Manager::TEMPLIST_OPTION_NAME );
713
  if( $unlinkedLists != null ) {
714
- $unlinkedLists[] = $temp_list;
715
  self::create_subscriber( 'subscribe', $email, $list_id, $info, $unlinkedLists );
716
  }
717
  else {
718
- self::create_subscriber( 'subscribe', $email, $list_id, $info, array( $temp_list ) );
719
  }
720
 
721
- // remove the record.
722
- $id = $contact_info['id'];
723
- SIB_Model_Users::remove_record( $id );
724
  }
725
 
726
  if ( '' != $contact_info['redirectUrl'] ) {
@@ -895,42 +880,7 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
895
  public static function create_default_dopt() {
896
 
897
  $mailin = new SendinblueApiClient();
898
-
899
- // get folder id
900
- $folder_data = $mailin->getAllFolders();
901
- foreach ( $folder_data['folders'] as $value ) {
902
- if ( 'FORM' == $value['name'] ) {
903
- $formFolderId = $value['id'];
904
- break;
905
- }
906
- }
907
- // create folder if not exists
908
- if ( empty( $formFolderId ) ){
909
- $data = ["name"=> "FORM"];
910
- $folderCreated = $mailin->createFolder($data);
911
- $formFolderId = $folderCreated['id'];
912
- }
913
-
914
- // add list.
915
- $isEmpty = false;
916
-
917
- $list_data = $mailin->getAllLists();
918
- foreach ( $list_data['lists'] as $value ) {
919
- if ( 'Temp - DOUBLE OPTIN' == $value['name'] ) {
920
- $isEmpty = true;
921
- break;
922
- }
923
- }
924
-
925
- if(!$isEmpty) {
926
- $data = array(
927
- 'name' => 'Temp - DOUBLE OPTIN',
928
- 'folderId' => $formFolderId,
929
- );
930
- $mailin->createList( $data );
931
- }
932
 
933
-
934
  // add attribute.
935
  $isEmpty = false;
936
  $ret = $mailin->getAttributes();
167
  if (!empty($list_data['lists'])) {
168
  foreach ( $list_data['lists'] as $value ) {
169
  if ( 'Temp - DOUBLE OPTIN' == $value['name'] ) {
 
 
170
  continue;
171
  }
172
  $lists[] = array(
175
  );
176
  }
177
  }
178
+
179
+ if ( count( $lists ) > 0 ) {
180
+ set_transient( 'sib_list_' . md5( SIB_Manager::$access_key ), $lists, self::DELAYTIME );
181
+ }
182
  }
183
  return $lists;
184
  }
301
 
302
  $isDopted = false;
303
 
 
 
304
  $desired_lists = $list_id;
305
 
306
  if ( 'double-optin' == $type ) {
307
+ $list_id = array();
308
  }
309
 
310
  // new user.
333
  if ( isset( $attrs['DOUBLE_OPT-IN'] ) && '1' == $attrs['DOUBLE_OPT-IN'] ) {
334
  $isDopted = true;
335
  }
 
 
 
 
336
 
337
  $diff = array_diff( $desired_lists, $listid );
338
  if ( ! empty( $diff ) ) {
340
  if ( 'double-optin' != $type ) {
341
  $listid = array_unique( array_merge( $listid, $list_id ) );
342
  }
 
 
 
343
  } else {
344
  if ( '1' == $res['emailBlacklisted'] ) {
345
  $status = 'update';
698
  {
699
  SIB_API_Manager::send_comfirm_email( 'confirm', $email, $current_form['confirmID'], $info );
700
  }
701
+
 
702
  if( $unlinkedLists != null ) {
 
703
  self::create_subscriber( 'subscribe', $email, $list_id, $info, $unlinkedLists );
704
  }
705
  else {
706
+ self::create_subscriber( 'subscribe', $email, $list_id, $info );
707
  }
708
 
 
 
 
709
  }
710
 
711
  if ( '' != $contact_info['redirectUrl'] ) {
880
  public static function create_default_dopt() {
881
 
882
  $mailin = new SendinblueApiClient();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
883
 
 
884
  // add attribute.
885
  $isEmpty = false;
886
  $ret = $mailin->getAttributes();
readme.txt CHANGED
@@ -115,6 +115,12 @@ In order to create a signup form, you need to:
115
 
116
  == Changelog ==
117
 
 
 
 
 
 
 
118
  = 3.1.14 =
119
  **Improvements**
120
 
115
 
116
  == Changelog ==
117
 
118
+ = 3.1.15 =
119
+ **Improvements**
120
+
121
+ * Fixed some minor issues related to double optin subscription
122
+ * Removed legacy code corresponding double optin subscription
123
+
124
  = 3.1.14 =
125
  **Improvements**
126
 
sendinblue.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Newsletter, SMTP, Email marketing and Subscribe forms by Sendinblue
4
  * Plugin URI: https://www.sendinblue.com/?r=wporg
5
  * Description: Manage your contact lists, subscription forms and all email and marketing-related topics from your wp panel, within one single plugin
6
- * Version: 3.1.14
7
  * Author: Sendinblue
8
  * Author URI: https://www.sendinblue.com/?r=wporg
9
  * License: GPLv2 or later
@@ -76,9 +76,6 @@ if ( ! class_exists( 'SIB_Manager' ) ) {
76
  /** Plugin language notice option name */
77
  const LANGUAGE_OPTION_NAME = 'sib_language_notice_option';
78
 
79
- /** Temp list of Dopt option name */
80
- const TEMPLIST_OPTION_NAME = 'sib_temp_list';
81
-
82
  /** Form preview option name */
83
  const PREVIEW_OPTION_NAME = 'sib_preview_form';
84
 
3
  * Plugin Name: Newsletter, SMTP, Email marketing and Subscribe forms by Sendinblue
4
  * Plugin URI: https://www.sendinblue.com/?r=wporg
5
  * Description: Manage your contact lists, subscription forms and all email and marketing-related topics from your wp panel, within one single plugin
6
+ * Version: 3.1.15
7
  * Author: Sendinblue
8
  * Author URI: https://www.sendinblue.com/?r=wporg
9
  * License: GPLv2 or later
76
  /** Plugin language notice option name */
77
  const LANGUAGE_OPTION_NAME = 'sib_language_notice_option';
78
 
 
 
 
79
  /** Form preview option name */
80
  const PREVIEW_OPTION_NAME = 'sib_preview_form';
81