SendinBlue Subscribe Form And WP SMTP - Version 3.1.4

Version Description

Bug fixes

  • Fixed an issue related to auto-creation of DOI list in FORM folder.
Download this release

Release Info

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

Code changes from version 3.1.3 to 3.1.4

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.3';
18
 
19
  private $apiKey;
20
  private $lastResponseCode;
@@ -200,6 +200,45 @@ class SendinblueApiClient
200
  return $lists;
201
  }
202
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
  /**
204
  * @param $data
205
  * @return mixed
14
  const RESPONSE_CODE_CREATED = 201;
15
  const RESPONSE_CODE_ACCEPTED = 202;
16
  const RESPONSE_CODE_UNAUTHORIZED = 401;
17
+ const PLUGIN_VERSION = '3.1.4';
18
 
19
  private $apiKey;
20
  private $lastResponseCode;
200
  return $lists;
201
  }
202
 
203
+ /**
204
+ * @param $data
205
+ * @return mixed
206
+ */
207
+ public function createFolder($data)
208
+ {
209
+ return $this->post("/contacts/folders", $data);
210
+ }
211
+
212
+ /**
213
+ * @param $data
214
+ * @return mixed
215
+ */
216
+ public function getFolders($data)
217
+ {
218
+ return $this->get("/contacts/folders", $data);
219
+ }
220
+
221
+ /**
222
+ * @param $data
223
+ * @return mixed
224
+ */
225
+ public function getAllFolders()
226
+ {
227
+ $folders = array("folders" => array(), "count" => 0);
228
+ $offset = 0;
229
+ $limit = 50;
230
+ do {
231
+ $folder_data = $this->getFolders(array('limit' => $limit, 'offset' => $offset));
232
+ if (isset($folder_data["folders"]) && is_array($folder_data["folders"])) {
233
+ $folders["folders"] = array_merge($folders["folders"], $folder_data["folders"]);
234
+ $offset += 50;
235
+ $folders["count"] = $folder_data["count"];
236
+ }
237
+ } while (!empty($folders['folders']) && count($folders["folders"]) < $folder_data["count"]);
238
+
239
+ return $folders;
240
+ }
241
+
242
  /**
243
  * @param $data
244
  * @return mixed
inc/sib-api-manager.php CHANGED
@@ -900,6 +900,22 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
900
  public static function create_default_dopt() {
901
 
902
  $mailin = new SendinblueApiClient();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
903
  // add list.
904
  $isEmpty = false;
905
 
@@ -914,7 +930,7 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
914
  if(!$isEmpty) {
915
  $data = array(
916
  'name' => 'Temp - DOUBLE OPTIN',
917
- 'folderId' => 1,
918
  );
919
  $mailin->createList( $data );
920
  }
@@ -945,7 +961,7 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
945
  ],
946
  ]
947
  ];
948
- $mailin->createAttribute('category', 'DOUBLE_OPT', $data);
949
  }
950
  }
951
  }
900
  public static function create_default_dopt() {
901
 
902
  $mailin = new SendinblueApiClient();
903
+
904
+ // get folder id
905
+ $folder_data = $mailin->getAllFolders();
906
+ foreach ( $folder_data['folders'] as $value ) {
907
+ if ( 'FORM' == $value['name'] ) {
908
+ $formFolderId = $value['id'];
909
+ break;
910
+ }
911
+ }
912
+ // create folder if not exists
913
+ if ( empty( $formFolderId ) ){
914
+ $data = ["name"=> "FORM"];
915
+ $folderCreated = $mailin->createFolder($data);
916
+ $formFolderId = $folderCreated['id'];
917
+ }
918
+
919
  // add list.
920
  $isEmpty = false;
921
 
930
  if(!$isEmpty) {
931
  $data = array(
932
  'name' => 'Temp - DOUBLE OPTIN',
933
+ 'folderId' => $formFolderId,
934
  );
935
  $mailin->createList( $data );
936
  }
961
  ],
962
  ]
963
  ];
964
+ $mailin->createAttribute('category', 'DOUBLE_OPT-IN', $data);
965
  }
966
  }
967
  }
readme.txt CHANGED
@@ -115,6 +115,11 @@ In order to create a signup form, you need to:
115
 
116
  == Changelog ==
117
 
 
 
 
 
 
118
  = 3.1.3 =
119
  **Bug fixes**
120
 
115
 
116
  == Changelog ==
117
 
118
+ = 3.1.4 =
119
+ **Bug fixes**
120
+
121
+ * Fixed an issue related to auto-creation of DOI list in FORM folder.
122
+
123
  = 3.1.3 =
124
  **Bug fixes**
125
 
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.3
7
  * Author: Sendinblue
8
  * Author URI: https://www.sendinblue.com/?r=wporg
9
  * License: GPLv2 or later
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.4
7
  * Author: Sendinblue
8
  * Author URI: https://www.sendinblue.com/?r=wporg
9
  * License: GPLv2 or later