Email Subscribers & Newsletters - Version 4.1.11

Version Description

(02.08.2019) = * Fix: Send multiple email notification issue

Download this release

Release Info

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

Code changes from version 4.1.10 to 4.1.11

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.1.10
7
  * Author: Icegram
8
  * Author URI: https://www.icegram.com/
9
  * Requires at least: 3.9
@@ -24,7 +24,7 @@ if ( ! defined( 'WPINC' ) ) {
24
  * Define constants
25
  */
26
  define( 'ES_PLUGIN_DIR', dirname( __FILE__ ) );
27
- define( 'ES_PLUGIN_VERSION', '4.1.10' );
28
  define( 'ES_PLUGIN_BASE_NAME', plugin_basename( __FILE__ ) );
29
 
30
  if ( ! defined( 'ES_PLUGIN_FILE' ) ) {
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.1.11
7
  * Author: Icegram
8
  * Author URI: https://www.icegram.com/
9
  * Requires at least: 3.9
24
  * Define constants
25
  */
26
  define( 'ES_PLUGIN_DIR', dirname( __FILE__ ) );
27
+ define( 'ES_PLUGIN_VERSION', '4.1.11' );
28
  define( 'ES_PLUGIN_BASE_NAME', plugin_basename( __FILE__ ) );
29
 
30
  if ( ! defined( 'ES_PLUGIN_FILE' ) ) {
includes/admin/class-es-cron.php CHANGED
@@ -116,9 +116,13 @@ class ES_Cron {
116
  $ids[] = $email['id'];
117
  }
118
 
119
- ES_DB_Sending_Queue::update_sent_status($ids, 'Sending');
 
120
  // Send out emails
121
- ES_Mailer::prepare_and_send_email( $emails, $notification );
 
 
 
122
 
123
  $total_remaining_emails = ES_DB_Sending_Queue::get_total_emails_to_be_sent_by_hash( $notification_guid );
124
  $remaining_emails_to_be_sent = ES_DB_Sending_Queue::get_total_emails_to_be_sent();
116
  $ids[] = $email['id'];
117
  }
118
 
119
+ $updated = ES_DB_Sending_Queue::update_sent_status($ids, 'Sending');
120
+
121
  // Send out emails
122
+ if($updated) {
123
+ ES_Mailer::prepare_and_send_email( $emails, $notification );
124
+ ES_DB_Sending_Queue::update_sent_status($ids, 'Sent');
125
+ }
126
 
127
  $total_remaining_emails = ES_DB_Sending_Queue::get_total_emails_to_be_sent_by_hash( $notification_guid );
128
  $remaining_emails_to_be_sent = ES_DB_Sending_Queue::get_total_emails_to_be_sent();
includes/admin/class-es-templates-table.php CHANGED
@@ -16,40 +16,57 @@ class ES_Templates_Table {
16
  add_filter( 'manage_edit-es_template_columns', array( $this, 'add_new_columns' ), 10, 1 );
17
  add_action( 'manage_posts_custom_column', array( $this, 'custom_columns' ) );
18
  add_action( 'admin_footer', array( $this, 'add_custom_button' ) );
 
19
  //duplicate template
20
  add_filter( 'post_row_actions', array(&$this , 'add_message_action'), 10, 2 );
21
  add_action('admin_init', array(&$this ,'duplicate_message') ,10, 1);
22
  }
23
 
24
- public function es_template_meta_box_add() {
25
- add_meta_box( 'es_template_meta_box', 'Select your Email Template Type', array( $this, 'es_template_type_meta_box' ), 'es_template', 'normal', 'high' );
26
- }
27
-
28
- public function es_template_type_meta_box( $post ) {
29
-
30
  if ( ! ( is_object( $post ) && 'es_template' === $post->post_type ) ) {
31
  return;
32
  }
33
-
34
  $values = get_post_custom( $post->ID );
35
 
36
  $selected = isset( $values['es_template_type'] ) ? esc_attr( $values['es_template_type'][0] ) : '';
37
- wp_nonce_field( 'es_template_type_nonce', 'template_type_nonce' );
38
- ?>
39
- <p>
40
- <label for="es_template_type"><? _e( 'Select your Email Template Type', 'email-subscirbers' ); ?></label>
 
 
 
41
  <select name="es_template_type" id="es_template_type">
42
- <option value="newsletter" <?php selected( $selected, 'newsletter' ); ?>><?php _e( 'Broadcast', 'email-subscribers' ) ?></option>
43
- <option value="post_notification" <?php selected( $selected, 'post_notification' ); ?>><?php _e( 'Post Notification', 'email-subscribers' ) ?></option>
 
 
 
 
 
 
44
  </select>
45
  </p>
 
 
46
 
 
 
 
 
 
 
 
 
 
 
47
  <p id="post_notification">
48
  <a href="https://www.icegram.com/documentation/es-what-are-the-available-keywords-in-the-post-notifications/?utm_source=es&amp;utm_medium=in_app&amp;utm_campaign=view_docs_help_page" target="_blank"><?php _e( 'Available Keywords', 'email-subscribers' ); ?></a> <?php _e( 'for Post Notification: ', 'email-subsribers' ); ?> {{FIRSTNAME}}, {{LASTNAME}}, {{NAME}}, {{EMAIL}},
49
  {{DATE}}, {{POSTTITLE}}, {{POSTIMAGE}}, {{POSTEXCERPT}}, {{POSTDESC}},
50
  {{POSTAUTHOR}}, {{POSTLINK}}, {{POSTLINK-WITHTITLE}}, {{POSTLINK-ONLY}}, {{POSTFULL}} </p>
51
  <p id="newsletter">
52
- <a href="https://www.icegram.com/documentation/es-what-are-the-available-keywords-in-the-newsletters/?utm_source=es&amp;utm_medium=in_app&amp;utm_campaign=view_docs_help_page" target="_blank"><?php _e( 'Available Keywords', 'email-subscribers' ); ?></a> <?php _e( 'for Newsletter:', 'email-subscribers' ); ?> {{FIRSTNAME}}, {{LASTNAME}}, {{NAME}}, {{EMAIL}} </p>
53
  <?php
54
  }
55
 
16
  add_filter( 'manage_edit-es_template_columns', array( $this, 'add_new_columns' ), 10, 1 );
17
  add_action( 'manage_posts_custom_column', array( $this, 'custom_columns' ) );
18
  add_action( 'admin_footer', array( $this, 'add_custom_button' ) );
19
+ add_action( 'edit_form_after_title', array( $this, 'add_template_type' ) );
20
  //duplicate template
21
  add_filter( 'post_row_actions', array(&$this , 'add_message_action'), 10, 2 );
22
  add_action('admin_init', array(&$this ,'duplicate_message') ,10, 1);
23
  }
24
 
25
+ public function add_template_type(){
26
+ global $post;
 
 
 
 
27
  if ( ! ( is_object( $post ) && 'es_template' === $post->post_type ) ) {
28
  return;
29
  }
 
30
  $values = get_post_custom( $post->ID );
31
 
32
  $selected = isset( $values['es_template_type'] ) ? esc_attr( $values['es_template_type'][0] ) : '';
33
+ $template_type = array('newsletter' => __( 'Broadcast', 'email-subscribers' ) ,
34
+ 'post_notification' => __( 'Post Notification', 'email-subscribers' )
35
+ );
36
+ $template_type = apply_filters( 'es_template_type', $template_type );
37
+ ?>
38
+ <p>
39
+ <label for="es_template_type"><strong><?php _e( 'Select your Email Template Type', 'email-subscirbers' ); ?></strong></label></br>
40
  <select name="es_template_type" id="es_template_type">
41
+ <?php
42
+ if(!empty($template_type)){
43
+ foreach ($template_type as $key => $value) {
44
+ echo "<option value=".$key." ".selected( $selected, $key, false ).">".$value."</option>";
45
+ }
46
+ }
47
+ ?>
48
+
49
  </select>
50
  </p>
51
+ <?php
52
+ }
53
 
54
+ public function es_template_meta_box_add() {
55
+ add_meta_box( 'es_template_meta_box', 'Available Keywords', array( $this, 'es_template_type_meta_box' ), 'es_template', 'normal', 'high' );
56
+ }
57
+
58
+ public function es_template_type_meta_box( $post ) {
59
+
60
+ if ( ! ( is_object( $post ) && 'es_template' === $post->post_type ) ) {
61
+ return;
62
+ }
63
+ ?>
64
  <p id="post_notification">
65
  <a href="https://www.icegram.com/documentation/es-what-are-the-available-keywords-in-the-post-notifications/?utm_source=es&amp;utm_medium=in_app&amp;utm_campaign=view_docs_help_page" target="_blank"><?php _e( 'Available Keywords', 'email-subscribers' ); ?></a> <?php _e( 'for Post Notification: ', 'email-subsribers' ); ?> {{FIRSTNAME}}, {{LASTNAME}}, {{NAME}}, {{EMAIL}},
66
  {{DATE}}, {{POSTTITLE}}, {{POSTIMAGE}}, {{POSTEXCERPT}}, {{POSTDESC}},
67
  {{POSTAUTHOR}}, {{POSTLINK}}, {{POSTLINK-WITHTITLE}}, {{POSTLINK-ONLY}}, {{POSTFULL}} </p>
68
  <p id="newsletter">
69
+ <a href="https://www.icegram.com/documentation/es-what-are-the-available-keywords-in-the-newsletters/?utm_source=es&amp;utm_medium=in_app&amp;utm_campaign=view_docs_help_page" target="_blank"><?php _e( 'Available Keywords', 'email-subscribers' ); ?></a> <?php _e( 'for Broadcast:', 'email-subscribers' ); ?> {{FIRSTNAME}}, {{LASTNAME}}, {{NAME}}, {{EMAIL}} </p>
70
  <?php
71
  }
72
 
includes/class-es-install.php CHANGED
@@ -286,7 +286,7 @@ class ES_Install {
286
  return;
287
  }
288
 
289
- set_transient( 'ig_es_updating', 'yes', MINUTE_IN_SECONDS * 30 );
290
 
291
  $current_db_version = get_ig_es_db_version();
292
  $update_queued = false;
286
  return;
287
  }
288
 
289
+ set_transient( 'ig_es_updating', 'yes', MINUTE_IN_SECONDS * 5 );
290
 
291
  $current_db_version = get_ig_es_db_version();
292
  $update_queued = false;
includes/class-es-mailer.php CHANGED
@@ -57,10 +57,7 @@ class ES_Mailer {
57
 
58
  if ( $send ) {
59
  ES_DB_Sending_Queue::update_sent_status( $mail['id'], 'Sent' );
60
- } else {
61
- ES_DB_Sending_Queue::update_sent_status( $mail['id'], 'In Queue' );
62
  }
63
-
64
  }
65
 
66
  }
57
 
58
  if ( $send ) {
59
  ES_DB_Sending_Queue::update_sent_status( $mail['id'], 'Sent' );
 
 
60
  }
 
61
  }
62
 
63
  }
includes/db/class-es-db-sending-queue.php CHANGED
@@ -432,17 +432,18 @@ class ES_DB_Sending_Queue {
432
 
433
  $result = 0;
434
 
435
- if( $hash != "" ) {
436
- $query = $wpdb->prepare("SELECT COUNT(*) AS count
437
- FROM ".IG_SENDING_QUEUE_TABLE ."
438
  WHERE opened = 1 AND mailing_queue_hash = %s", array( $hash ) );
439
  $result = $wpdb->get_var( $query );
440
- if( $result === 0 ){
 
441
  $es_deliver_report_table = EMAIL_SUBSCRIBERS_STATS_TABLE;
442
- $result = $wpdb->get_var( "SHOW TABLES LIKE '{$es_deliver_report_table}' " );
443
- if ( $result === $es_deliver_report_table ) {
444
  $query = $wpdb->prepare( "SELECT COUNT(*) AS count FROM {$es_deliver_report_table} WHERE es_deliver_status = 'Viewed' AND es_deliver_sentguid = %s", array( $hash ) );
445
- $emails = $wpdb->get_results( $query, ARRAY_A );
446
  }
447
  }
448
 
@@ -458,17 +459,17 @@ class ES_DB_Sending_Queue {
458
 
459
  $result = 0;
460
 
461
- if( $hash != "" ) {
462
- $query = $wpdb->prepare("SELECT COUNT(*) AS count
463
- FROM ".IG_SENDING_QUEUE_TABLE ."
464
  WHERE mailing_queue_hash = %s", array( $hash ) );
465
  $result = $wpdb->get_var( $query );
466
- if( $result === 0 ){
467
  $es_deliver_report_table = EMAIL_SUBSCRIBERS_STATS_TABLE;
468
- $result = $wpdb->get_var( "SHOW TABLES LIKE '{$es_deliver_report_table}' " );
469
- if ( $result === $es_deliver_report_table ) {
470
  $query = $wpdb->prepare( "SELECT COUNT(*) AS count FROM {$es_deliver_report_table} WHERE es_deliver_sentguid = %s", array( $hash ) );
471
- $emails = $wpdb->get_results( $query, ARRAY_A );
472
  }
473
  }
474
  }
432
 
433
  $result = 0;
434
 
435
+ if ( $hash != "" ) {
436
+ $query = $wpdb->prepare( "SELECT COUNT(*) AS count
437
+ FROM " . IG_SENDING_QUEUE_TABLE . "
438
  WHERE opened = 1 AND mailing_queue_hash = %s", array( $hash ) );
439
  $result = $wpdb->get_var( $query );
440
+
441
+ if ( $result == 0 ) {
442
  $es_deliver_report_table = EMAIL_SUBSCRIBERS_STATS_TABLE;
443
+ $table_name = $wpdb->get_var( "SHOW TABLES LIKE '{$es_deliver_report_table}' " );
444
+ if ( $table_name === $es_deliver_report_table ) {
445
  $query = $wpdb->prepare( "SELECT COUNT(*) AS count FROM {$es_deliver_report_table} WHERE es_deliver_status = 'Viewed' AND es_deliver_sentguid = %s", array( $hash ) );
446
+ $result = $wpdb->get_var( $query );
447
  }
448
  }
449
 
459
 
460
  $result = 0;
461
 
462
+ if ( $hash != "" ) {
463
+ $query = $wpdb->prepare( "SELECT COUNT(*) AS count
464
+ FROM " . IG_SENDING_QUEUE_TABLE . "
465
  WHERE mailing_queue_hash = %s", array( $hash ) );
466
  $result = $wpdb->get_var( $query );
467
+ if ( $result == 0 ) {
468
  $es_deliver_report_table = EMAIL_SUBSCRIBERS_STATS_TABLE;
469
+ $table_name = $wpdb->get_var( "SHOW TABLES LIKE '{$es_deliver_report_table}' " );
470
+ if ( $table_name === $es_deliver_report_table ) {
471
  $query = $wpdb->prepare( "SELECT COUNT(*) AS count FROM {$es_deliver_report_table} WHERE es_deliver_sentguid = %s", array( $hash ) );
472
+ $result = $wpdb->get_var( $query );
473
  }
474
  }
475
  }
readme.txt CHANGED
@@ -5,7 +5,7 @@ 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.2.2
8
- Stable tag: 4.1.10
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses
11
 
@@ -305,6 +305,9 @@ Use our free plugin [Email Subscribers - Group Selector](https://wordpress.org/p
305
 
306
  == Changelog ==
307
 
 
 
 
308
  = 4.1.10 (31.07.2019) =
309
  * Update: Added viewed count on reports page
310
  * Fix: Shortcodes were not working in email templates
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.2.2
8
+ Stable tag: 4.1.11
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses
11
 
305
 
306
  == Changelog ==
307
 
308
+ = 4.1.11 (02.08.2019) =
309
+ * Fix: Send multiple email notification issue
310
+
311
  = 4.1.10 (31.07.2019) =
312
  * Update: Added viewed count on reports page
313
  * Fix: Shortcodes were not working in email templates