Email Subscribers & Newsletters - Version 4.3.7

Version Description

Download this release

Release Info

Developer Icegram
Plugin Icon 128x128 Email Subscribers & Newsletters
Version 4.3.7
Comparing to
See all releases

Code changes from version 4.3.6 to 4.3.7

email-subscribers.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Email Subscribers & Newsletters
4
  * Plugin URI: https://www.icegram.com/
5
  * Description: Add subscription forms on website, send HTML newsletters & automatically notify subscribers about new blog posts once it is published.
6
- * Version: 4.3.6
7
  * Author: Icegram
8
  * Author URI: https://www.icegram.com/
9
  * Requires at least: 3.9
@@ -111,7 +111,7 @@ if ( $is_premium ) {
111
  /* ***************************** Initial Compatibility Work (End) ******************* */
112
 
113
  if ( ! defined( 'ES_PLUGIN_VERSION' ) ) {
114
- define( 'ES_PLUGIN_VERSION', '4.3.6' );
115
  }
116
 
117
  // Plugin Folder Path.
3
  * Plugin Name: Email Subscribers & Newsletters
4
  * Plugin URI: https://www.icegram.com/
5
  * Description: Add subscription forms on website, send HTML newsletters & automatically notify subscribers about new blog posts once it is published.
6
+ * Version: 4.3.7
7
  * Author: Icegram
8
  * Author URI: https://www.icegram.com/
9
  * Requires at least: 3.9
111
  /* ***************************** Initial Compatibility Work (End) ******************* */
112
 
113
  if ( ! defined( 'ES_PLUGIN_VERSION' ) ) {
114
+ define( 'ES_PLUGIN_VERSION', '4.3.7' );
115
  }
116
 
117
  // Plugin Folder Path.
lite/includes/classes/class-es-handle-post-notification.php CHANGED
@@ -31,7 +31,6 @@ class ES_Handle_Post_Notification {
31
 
32
  public function prepare_post_data( $prepared_post, $request ) {
33
  $this->is_rest_request = true;
34
-
35
  return $prepared_post;
36
  }
37
 
31
 
32
  public function prepare_post_data( $prepared_post, $request ) {
33
  $this->is_rest_request = true;
 
34
  return $prepared_post;
35
  }
36
 
lite/includes/classes/class-es-import-subscribers.php CHANGED
@@ -313,9 +313,16 @@ class ES_Import_Subscribers {
313
  }
314
  $i ++;
315
  }
316
- $results = array_keys( $results, max( $results ) );
317
 
318
- return $results[0];
 
 
 
 
 
 
 
 
319
  }
320
 
321
  }
313
  }
314
  $i ++;
315
  }
 
316
 
317
+ if ( count( $results ) > 0 ) {
318
+
319
+ $results = array_keys( $results, max( $results ) );
320
+
321
+ return $results[0];
322
+ }
323
+
324
+ return ',';
325
+
326
  }
327
 
328
  }
lite/includes/classes/class-es-mailer.php CHANGED
@@ -559,7 +559,11 @@ if ( ! class_exists( 'ES_Mailer' ) ) {
559
  $emails = array( $emails );
560
  }
561
 
562
- $this->email_id_map = ES()->contacts_db->get_email_id_map( (array) $emails );
 
 
 
 
563
 
564
  foreach ( (array) $emails as $email ) {
565
 
@@ -1208,11 +1212,11 @@ if ( ! class_exists( 'ES_Mailer' ) ) {
1208
  }
1209
 
1210
  /**
1211
- * Get max email send at once count
1212
- *
1213
  * @return int
1214
- *
1215
- * @since 4.3.5
1216
  */
1217
  public function get_max_email_send_at_once_count() {
1218
  $max_count = (int) ES_Common::get_ig_option( 'max_email_send_at_once', IG_ES_MAX_EMAIL_SEND_AT_ONCE );
559
  $emails = array( $emails );
560
  }
561
 
562
+ if ( 0 === $campaign_id ) {
563
+ $this->email_id_map = ES()->contacts_db->get_email_id_map( (array) $emails );
564
+ } else {
565
+ $this->email_id_map = ES_DB_Sending_Queue::get_emails_id_map_by_campaign( $campaign_id, $emails );
566
+ }
567
 
568
  foreach ( (array) $emails as $email ) {
569
 
1212
  }
1213
 
1214
  /**
1215
+ * Get max email send at once count
1216
+ *
1217
  * @return int
1218
+ *
1219
+ * @since 4.3.5
1220
  */
1221
  public function get_max_email_send_at_once_count() {
1222
  $max_count = (int) ES_Common::get_ig_option( 'max_email_send_at_once', IG_ES_MAX_EMAIL_SEND_AT_ONCE );
lite/includes/db/class-es-db-sending-queue.php CHANGED
@@ -184,6 +184,7 @@ class ES_DB_Sending_Queue {
184
 
185
  $batches = array_chunk( $delivery_data['subscribers'], 50 );
186
 
 
187
  foreach ( $batches as $key => $batch ) {
188
  $place_holders = $values = array();
189
  foreach ( $batch as $subscriber ) {
@@ -191,7 +192,9 @@ class ES_DB_Sending_Queue {
191
  $email = ! empty( $subscriber['email'] ) ? $subscriber['email'] : '';
192
  $contact_id = ! empty( $subscriber['id'] ) ? $subscriber['id'] : 0;
193
 
194
- if ( ! empty( $email ) ) {
 
 
195
 
196
  $data['contact_id'] = $contact_id;
197
  $data['email'] = $email;
@@ -517,4 +520,40 @@ class ES_DB_Sending_Queue {
517
  return $wpdb->get_var( $wpdb->prepare( $query, $args ) );
518
  }
519
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
520
  }
184
 
185
  $batches = array_chunk( $delivery_data['subscribers'], 50 );
186
 
187
+ $emails = array();
188
  foreach ( $batches as $key => $batch ) {
189
  $place_holders = $values = array();
190
  foreach ( $batch as $subscriber ) {
192
  $email = ! empty( $subscriber['email'] ) ? $subscriber['email'] : '';
193
  $contact_id = ! empty( $subscriber['id'] ) ? $subscriber['id'] : 0;
194
 
195
+ if ( ! empty( $email ) && ! in_array( $email, $emails ) ) {
196
+
197
+ $emails[] = $email;
198
 
199
  $data['contact_id'] = $contact_id;
200
  $data['email'] = $email;
520
  return $wpdb->get_var( $wpdb->prepare( $query, $args ) );
521
  }
522
 
523
+ /**
524
+ * Get Email => ID map based on Sending Queue table
525
+ *
526
+ * @param int $campaign_id
527
+ * @param array $emails
528
+ *
529
+ * @return array
530
+ *
531
+ * @since 4.3.7
532
+ */
533
+ public static function get_emails_id_map_by_campaign( $campaign_id = 0, $emails = array() ) {
534
+ global $wpdb;
535
+
536
+ $emails = esc_sql( $emails );
537
+ $campaign_id = esc_sql( absint( $campaign_id ) );
538
+
539
+ if ( 0 === $campaign_id || empty( $emails ) ) {
540
+ return array();
541
+ }
542
+
543
+ $emails_str = "'" . implode( "', '", $emails ) . "'";
544
+
545
+ $query = "SELECT contact_id, email FROM {$wpdb->prefix}ig_sending_queue WHERE campaign_id = %d AND email IN ($emails_str)";
546
+
547
+ $results = $wpdb->get_results( $wpdb->prepare( $query, $campaign_id ), ARRAY_A );
548
+
549
+ $emails_id_map = array();
550
+ if ( count( $results ) > 0 ) {
551
+ foreach ( $results as $result ) {
552
+ $emails_id_map[ $result['email'] ] = $result['contact_id'];
553
+ }
554
+ }
555
+
556
+ return $emails_id_map;
557
+ }
558
+
559
  }
lite/includes/es-backward.php CHANGED
@@ -57,6 +57,7 @@ class es_cls_dbquery {
57
  $optin_type = ( $optin_type === 'double_opt_in' ) ? 2 : 1;
58
 
59
  $status = 'subscribed';
 
60
  if ( $optin_type == 2 ) {
61
  $status = 'unconfirmed';
62
  }
57
  $optin_type = ( $optin_type === 'double_opt_in' ) ? 2 : 1;
58
 
59
  $status = 'subscribed';
60
+
61
  if ( $optin_type == 2 ) {
62
  $status = 'unconfirmed';
63
  }
readme.txt CHANGED
@@ -4,8 +4,8 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Author URI: https://www.icegram.com/
5
  Tags: subscription, newsletter, email marketing, post notification, email newsletter form, email signup, email widget, newsletter signup, subscribe, subscription form, bulk emails, signup form, list builder, lead generation, welcome email, contacts
6
  Requires at least: 3.9
7
- Tested up to: 5.3
8
- Stable tag: 4.3.6
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses
11
 
@@ -299,6 +299,10 @@ Refer [here](https://www.icegram.com/documentation/es-faq/).
299
 
300
  == Changelog ==
301
 
 
 
 
 
302
  **4.3.6 (12.12.2019)**
303
  * Update: Improve on boarding
304
  * Fix: Count shows zero (0) even if contacts available in list
4
  Author URI: https://www.icegram.com/
5
  Tags: subscription, newsletter, email marketing, post notification, email newsletter form, email signup, email widget, newsletter signup, subscribe, subscription form, bulk emails, signup form, list builder, lead generation, welcome email, contacts
6
  Requires at least: 3.9
7
+ Tested up to: 5.3.1
8
+ Stable tag: 4.3.7
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses
11
 
299
 
300
  == Changelog ==
301
 
302
+ **4.3.7 (18.12.2019)**
303
+ * Update: Improved import contacts functionality. Now, we are able to import ".CSV" file which contains only emails
304
+ * Fix: Multiple emails to contacts
305
+
306
  **4.3.6 (12.12.2019)**
307
  * Update: Improve on boarding
308
  * Fix: Count shows zero (0) even if contacts available in list