SendGrid - Version 1.9.3

Version Description

  • Added BuddyPress integration
  • MC API Key is now saved on focusout
  • Added posibility of using plain text template for subscription confirmation email
  • Added posibility of adding shortcodes to subscription confirmation pages
Download this release

Release Info

Developer team-rs
Plugin Icon 128x128 SendGrid
Version 1.9.3
Comparing to
See all releases

Code changes from version 1.9.2 to 1.9.3

lib/class-sendgrid-filters.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once plugin_dir_path( __FILE__ ) . 'integration/class-buddypress.php';
4
+
5
+ class Sendgrid_Filters {
6
+ public $integrations;
7
+
8
+ public function __construct() {
9
+ $integrations = array();
10
+ $integrations[] = new Sendgrid_BuddyPress_Integration();
11
+
12
+ foreach ( $integrations as $integration ) {
13
+ add_action( 'init', array( $integration, 'register' ) );
14
+ }
15
+ }
16
+ }
lib/class-sendgrid-mc-optin.php CHANGED
@@ -81,18 +81,19 @@ class Sendgrid_OptIn_API_Endpoint{
81
 
82
  if ( $subscribed )
83
  {
84
- set_transient( $token, null );
85
  $page = Sendgrid_Tools::get_mc_signup_confirmation_page_url();
 
86
  if ( $page == false ) {
 
87
  wp_redirect( 'sg-subscription-success' );
88
 
89
  exit();
90
  }
91
  else
92
  {
93
- wp_redirect( $page );
94
-
95
- exit();
96
  }
97
 
98
  return;
@@ -116,13 +117,15 @@ class Sendgrid_OptIn_API_Endpoint{
116
  public static function send_confirmation_email( $email, $first_name = '', $last_name = '', $from_settings = false ) {
117
  $subject = Sendgrid_Tools::get_mc_signup_email_subject();
118
  $content = Sendgrid_Tools::get_mc_signup_email_content();
 
119
 
120
- if ( false == $subject or false == $content ) {
121
  return false;
122
  }
123
 
124
  $subject = stripslashes( $subject );
125
  $content = stripslashes( $content );
 
126
  $to = array( $email );
127
 
128
  $token = Sendgrid_OptIn_API_Endpoint::generate_email_token( $email, $first_name, $last_name );
@@ -147,9 +150,9 @@ class Sendgrid_OptIn_API_Endpoint{
147
  $headers->addSubstitution( '%confirmation_link%', array( $confirmation_link ) )
148
  ->addCategory( 'wp_sendgrid_subscription_widget' );
149
 
150
- add_filter( 'wp_mail_content_type', 'set_html_content_type' );
 
151
  $result = wp_mail( $to, $subject, $content, $headers );
152
- remove_filter( 'wp_mail_content_type', 'set_html_content_type' );
153
 
154
  return $result;
155
  }
@@ -164,6 +167,108 @@ class Sendgrid_OptIn_API_Endpoint{
164
  }
165
  }
166
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  // Initialize OptIn Endopint
168
  new Sendgrid_OptIn_API_Endpoint();
169
 
@@ -171,3 +276,5 @@ add_action( 'init', 'sg_create_subscribe_general_error_page' );
171
  add_action( 'init', 'sg_create_subscribe_missing_token_error_page' );
172
  add_action( 'init', 'sg_create_subscribe_invalid_token_error_page' );
173
  add_action( 'init', 'sg_create_subscribe_success_page' );
 
 
81
 
82
  if ( $subscribed )
83
  {
 
84
  $page = Sendgrid_Tools::get_mc_signup_confirmation_page_url();
85
+
86
  if ( $page == false ) {
87
+ set_transient( $token, null );
88
  wp_redirect( 'sg-subscription-success' );
89
 
90
  exit();
91
  }
92
  else
93
  {
94
+ $page = add_query_arg( 'sg_token', $token, $page );
95
+ wp_redirect( $page );
96
+ exit();
97
  }
98
 
99
  return;
117
  public static function send_confirmation_email( $email, $first_name = '', $last_name = '', $from_settings = false ) {
118
  $subject = Sendgrid_Tools::get_mc_signup_email_subject();
119
  $content = Sendgrid_Tools::get_mc_signup_email_content();
120
+ $content_text = Sendgrid_Tools::get_mc_signup_email_content_text();
121
 
122
+ if ( false == $subject or false == $content or false == $content_text ) {
123
  return false;
124
  }
125
 
126
  $subject = stripslashes( $subject );
127
  $content = stripslashes( $content );
128
+ $content_text = stripslashes( $content_text );
129
  $to = array( $email );
130
 
131
  $token = Sendgrid_OptIn_API_Endpoint::generate_email_token( $email, $first_name, $last_name );
150
  $headers->addSubstitution( '%confirmation_link%', array( $confirmation_link ) )
151
  ->addCategory( 'wp_sendgrid_subscription_widget' );
152
 
153
+ add_filter( 'sendgrid_mail_text', function() use ( &$content_text ) { return $content_text; } );
154
+
155
  $result = wp_mail( $to, $subject, $content, $headers );
 
156
 
157
  return $result;
158
  }
167
  }
168
  }
169
 
170
+ /**
171
+ * register first name as a shortcode
172
+ *
173
+ * @param array $atts an associative array of attributes
174
+ *
175
+ * @return string first name
176
+ */
177
+ function register_shortcode_first_name($atts)
178
+ {
179
+ if ( ! isset( $_GET['sg_token'] ) ) {
180
+ return '';
181
+ }
182
+
183
+ $token = $_GET['sg_token'];
184
+ $transient = get_transient( $token );
185
+
186
+ if ( ! $transient ||
187
+ ! is_array( $transient ) ||
188
+ ! isset( $transient['first_name'] ) )
189
+ {
190
+ return '';
191
+ }
192
+
193
+ return $transient['first_name'];
194
+ }
195
+
196
+ /**
197
+ * register last name as a shortcode
198
+ *
199
+ * @param array $atts an associative array of attributes
200
+ *
201
+ * @return string last name
202
+ */
203
+ function register_shortcode_last_name($atts)
204
+ {
205
+ if ( ! isset( $_GET['sg_token'] ) ) {
206
+ return '';
207
+ }
208
+
209
+ $token = $_GET['sg_token'];
210
+ $transient = get_transient( $token );
211
+
212
+ if ( ! $transient ||
213
+ ! is_array( $transient ) ||
214
+ ! isset( $transient['last_name'] ) )
215
+ {
216
+ return '';
217
+ }
218
+
219
+ return $transient['last_name'];
220
+ }
221
+
222
+ /**
223
+ * register email as a shortcode
224
+ *
225
+ * @param array $atts an associative array of attributes
226
+ *
227
+ * @return string email
228
+ */
229
+ function register_shortcode_email($atts)
230
+ {
231
+ if ( ! isset( $_GET['sg_token'] ) ) {
232
+ return '';
233
+ }
234
+
235
+ $token = $_GET['sg_token'];
236
+ $transient = get_transient( $token );
237
+
238
+ if ( ! $transient ||
239
+ ! is_array( $transient ) ||
240
+ ! isset( $transient['email'] ) )
241
+ {
242
+ return '';
243
+ }
244
+
245
+ return $transient['email'];
246
+ }
247
+
248
+ /**
249
+ * register shortcodes
250
+ *
251
+ * @return void
252
+ */
253
+ function sg_register_shortcodes()
254
+ {
255
+ add_shortcode( 'sendgridSubscriptionFirstName', 'register_shortcode_first_name' );
256
+ add_shortcode( 'sendgridSubscriptionLastName', 'register_shortcode_last_name' );
257
+ add_shortcode( 'sendgridSubscriptionEmail', 'register_shortcode_email' );
258
+ }
259
+
260
+ function sg_invalidate_token() {
261
+ if ( ! isset( $_GET['sg_token'] ) ) {
262
+ return;
263
+ }
264
+
265
+ $token = $_GET['sg_token'];
266
+ $transient = get_transient( $token );
267
+ if ( $token && $transient ) {
268
+ set_transient( $token, null );
269
+ }
270
+ }
271
+
272
  // Initialize OptIn Endopint
273
  new Sendgrid_OptIn_API_Endpoint();
274
 
276
  add_action( 'init', 'sg_create_subscribe_missing_token_error_page' );
277
  add_action( 'init', 'sg_create_subscribe_invalid_token_error_page' );
278
  add_action( 'init', 'sg_create_subscribe_success_page' );
279
+ add_action( 'init', 'sg_register_shortcodes' );
280
+ add_action( 'wp_footer', 'sg_invalidate_token' );
lib/class-sendgrid-settings.php CHANGED
@@ -9,6 +9,7 @@ require_once plugin_dir_path( __FILE__ ) . 'class-sendgrid-nlvx-widget.php';
9
  class Sendgrid_Settings {
10
  const DEFAULT_SIGNUP_EMAIL_SUBJECT = 'Confirm your subscription to ';
11
  const DEFAULT_SIGNUP_EMAIL_CONTENT = '&lt;p&gt;Greetings!&lt;/p&gt;&#13;&#10;&#13;&#10;&lt;p&gt;Please click &lt;a href=&quot;%confirmation_link%&quot;&gt;here&lt;/a&gt; in order to subscribe to our newsletter!&lt;/p&gt;&#13;&#10;&#13;&#10;&lt;p&gt;Thank you,&lt;/p&gt;&#13;&#10;&lt;p&gt;';
 
12
 
13
  /**
14
  * Settings class constructor
@@ -146,6 +147,12 @@ class Sendgrid_Settings {
146
  }
147
  $mc_signup_email_content = stripslashes( $mc_signup_email_content );
148
 
 
 
 
 
 
 
149
  $confirmation_pages = get_pages( array( 'parent' => 0 ) );
150
 
151
  $checked_use_transactional = '';
@@ -258,21 +265,22 @@ class Sendgrid_Settings {
258
  }
259
  }
260
 
261
- $is_env_auth_method = defined( 'SENDGRID_AUTH_METHOD' );
262
- $is_env_send_method = defined( 'SENDGRID_SEND_METHOD' );
263
- $is_env_username = defined( 'SENDGRID_USERNAME' );
264
- $is_env_password = defined( 'SENDGRID_PASSWORD' );
265
- $is_env_api_key = defined( 'SENDGRID_API_KEY' );
266
- $is_env_port = defined( 'SENDGRID_PORT' );
267
- $is_env_content_type = defined( 'SENDGRID_CONTENT_TYPE' );
268
- $is_env_mc_api_key = defined( 'SENDGRID_MC_API_KEY' );
269
- $is_env_mc_list_id = defined( 'SENDGRID_MC_LIST_ID' );
270
- $is_env_mc_opt_use_transactional = defined( 'SENDGRID_MC_OPT_USE_TRANSACTIONAL' );
271
- $is_env_mc_opt_incl_fname_lname = defined( 'SENDGRID_MC_OPT_INCL_FNAME_LNAME' );
272
- $is_env_mc_opt_req_fname_lname = defined( 'SENDGRID_MC_OPT_REQ_FNAME_LNAME' );
273
- $is_env_mc_signup_email_subject = defined( 'SENDGRID_MC_SIGNUP_EMAIL_SUBJECT' );
274
- $is_env_mc_signup_email_content = defined( 'SENDGRID_MC_SIGNUP_EMAIL_CONTENT' );
275
- $is_env_mc_signup_confirmation_page = defined( 'SENDGRID_MC_SIGNUP_CONFIRMATION_PAGE' );
 
276
 
277
  if ( $response and $status != 'error' ) {
278
  $message = $response['message'];
@@ -418,6 +426,17 @@ class Sendgrid_Settings {
418
  }
419
  }
420
 
 
 
 
 
 
 
 
 
 
 
 
421
  if ( isset( $params['sendgrid_mc_signup_page'] ) and ! defined( 'SENDGRID_MC_SIGNUP_CONFIRMATION_PAGE' ) ) {
422
  Sendgrid_Tools::set_mc_signup_confirmation_page( $params['sendgrid_mc_signup_page'] );
423
  }
9
  class Sendgrid_Settings {
10
  const DEFAULT_SIGNUP_EMAIL_SUBJECT = 'Confirm your subscription to ';
11
  const DEFAULT_SIGNUP_EMAIL_CONTENT = '&lt;p&gt;Greetings!&lt;/p&gt;&#13;&#10;&#13;&#10;&lt;p&gt;Please click &lt;a href=&quot;%confirmation_link%&quot;&gt;here&lt;/a&gt; in order to subscribe to our newsletter!&lt;/p&gt;&#13;&#10;&#13;&#10;&lt;p&gt;Thank you,&lt;/p&gt;&#13;&#10;&lt;p&gt;';
12
+ const DEFAULT_SIGNUP_EMAIL_CONTENT_TEXT = 'Greetings!&#13;&#10;&#13;&#10;Please open %confirmation_link% in order to subscribe to our newsletter!&#13;&#10;&#13;&#10;Thank you,&#13;&#10;';
13
 
14
  /**
15
  * Settings class constructor
147
  }
148
  $mc_signup_email_content = stripslashes( $mc_signup_email_content );
149
 
150
+ $mc_signup_email_content_text = Sendgrid_Tools::get_mc_signup_email_content_text();
151
+ if ( false == $mc_signup_email_content_text ) {
152
+ $mc_signup_email_content_text = self::DEFAULT_SIGNUP_EMAIL_CONTENT_TEXT . get_bloginfo('name');
153
+ }
154
+ $mc_signup_email_content_text = stripslashes( $mc_signup_email_content_text );
155
+
156
  $confirmation_pages = get_pages( array( 'parent' => 0 ) );
157
 
158
  $checked_use_transactional = '';
265
  }
266
  }
267
 
268
+ $is_env_auth_method = defined( 'SENDGRID_AUTH_METHOD' );
269
+ $is_env_send_method = defined( 'SENDGRID_SEND_METHOD' );
270
+ $is_env_username = defined( 'SENDGRID_USERNAME' );
271
+ $is_env_password = defined( 'SENDGRID_PASSWORD' );
272
+ $is_env_api_key = defined( 'SENDGRID_API_KEY' );
273
+ $is_env_port = defined( 'SENDGRID_PORT' );
274
+ $is_env_content_type = defined( 'SENDGRID_CONTENT_TYPE' );
275
+ $is_env_mc_api_key = defined( 'SENDGRID_MC_API_KEY' );
276
+ $is_env_mc_list_id = defined( 'SENDGRID_MC_LIST_ID' );
277
+ $is_env_mc_opt_use_transactional = defined( 'SENDGRID_MC_OPT_USE_TRANSACTIONAL' );
278
+ $is_env_mc_opt_incl_fname_lname = defined( 'SENDGRID_MC_OPT_INCL_FNAME_LNAME' );
279
+ $is_env_mc_opt_req_fname_lname = defined( 'SENDGRID_MC_OPT_REQ_FNAME_LNAME' );
280
+ $is_env_mc_signup_email_subject = defined( 'SENDGRID_MC_SIGNUP_EMAIL_SUBJECT' );
281
+ $is_env_mc_signup_email_content = defined( 'SENDGRID_MC_SIGNUP_EMAIL_CONTENT' );
282
+ $is_env_mc_signup_email_content_text = defined( 'SENDGRID_MC_SIGNUP_EMAIL_CONTENT_TEXT' );
283
+ $is_env_mc_signup_confirmation_page = defined( 'SENDGRID_MC_SIGNUP_CONFIRMATION_PAGE' );
284
 
285
  if ( $response and $status != 'error' ) {
286
  $message = $response['message'];
426
  }
427
  }
428
 
429
+ if ( ! defined( 'SENDGRID_MC_SIGNUP_EMAIL_CONTENT_TEXT' ) ) {
430
+ if ( ! isset( $params['sendgrid_mc_email_content_text'] ) or empty( $params['sendgrid_mc_email_content_text'] ) ) {
431
+ $response = array(
432
+ 'message' => 'Signup email content plain/text cannot be empty.',
433
+ 'status' => 'error'
434
+ );
435
+ } else {
436
+ Sendgrid_Tools::set_mc_signup_email_content_text( $params['sendgrid_mc_email_content_text'] );
437
+ }
438
+ }
439
+
440
  if ( isset( $params['sendgrid_mc_signup_page'] ) and ! defined( 'SENDGRID_MC_SIGNUP_CONFIRMATION_PAGE' ) ) {
441
  Sendgrid_Tools::set_mc_signup_confirmation_page( $params['sendgrid_mc_signup_page'] );
442
  }
lib/class-sendgrid-tools.php CHANGED
@@ -423,6 +423,20 @@ class Sendgrid_Tools
423
  }
424
  }
425
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
426
  /**
427
  * Return the value for the signup confirmation page from the database or global variable
428
  *
@@ -575,6 +589,18 @@ class Sendgrid_Tools
575
  return update_option( 'sendgrid_mc_signup_email_content', $email_content );
576
  }
577
 
 
 
 
 
 
 
 
 
 
 
 
 
578
  /**
579
  * Sets the signup confirmation page in the database
580
  *
423
  }
424
  }
425
 
426
+ /**
427
+ * Return the value for the signup email contents (plain text) from the database or global variable
428
+ *
429
+ * @return mixed signup email contents - plain text, false if the value is not found
430
+ */
431
+ public static function get_mc_signup_email_content_text()
432
+ {
433
+ if ( defined( 'SENDGRID_MC_SIGNUP_EMAIL_CONTENT_TEXT' ) ) {
434
+ return SENDGRID_MC_SIGNUP_EMAIL_CONTENT_TEXT;
435
+ } else {
436
+ return get_option( 'sendgrid_mc_signup_email_content_text' );
437
+ }
438
+ }
439
+
440
  /**
441
  * Return the value for the signup confirmation page from the database or global variable
442
  *
589
  return update_option( 'sendgrid_mc_signup_email_content', $email_content );
590
  }
591
 
592
+ /**
593
+ * Sets the signup email contents (plain text) in the database
594
+ *
595
+ * @param type string $email_content
596
+ *
597
+ * @return bool
598
+ */
599
+ public static function set_mc_signup_email_content_text( $email_content )
600
+ {
601
+ return update_option( 'sendgrid_mc_signup_email_content_text', $email_content );
602
+ }
603
+
604
  /**
605
  * Sets the signup confirmation page in the database
606
  *
lib/integration/class-buddypress-override.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once plugin_dir_path( __FILE__ ) . '../class-sendgrid-tools.php';
4
+
5
+ class SendGrid_BuddyPress_Mailer implements BP_Email_Delivery {
6
+ public function bp_email( BP_Email $email ) {
7
+ $recipients = $email->get_to();
8
+ $to = array();
9
+ foreach ( $recipients as $recipient ) {
10
+ $to[] = $recipient->get_address();
11
+ }
12
+
13
+ $subject = $email->get_subject( 'replace-tokens' );
14
+ $message = normalize_whitespace( $email->get_content_plaintext( 'replace-tokens' ) );
15
+
16
+ $filter_set = false;
17
+
18
+ if ( 'plaintext' != Sendgrid_Tools::get_content_type() ) {
19
+ add_filter( 'wp_mail_content_type', array( $this, 'set_html_content_type' ), 100 );
20
+ $filter_set = true;
21
+ $message = $email->get_template( 'add-content' );
22
+ }
23
+
24
+ $result = wp_mail( $to, $subject, $message );
25
+
26
+ if ( $filter_set ) {
27
+ remove_filter( 'wp_mail_content_type', array( $this, 'set_html_content_type' ) );
28
+ }
29
+
30
+ return $result;
31
+ }
32
+
33
+ function set_html_content_type( $content_type ) {
34
+ return 'text/html';
35
+ }
36
+ }
lib/integration/class-buddypress.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Sendgrid_BuddyPress_Integration {
3
+ public function __construct() {
4
+ }
5
+
6
+ public function register() {
7
+ if ( ! defined( 'SENDGRID_DISABLE_BUDDYPRESS' ) ) {
8
+ add_filter( 'bp_email_use_wp_mail', array( $this, 'buddypress_email_use_wp_mail' ), 10, 1 );
9
+ add_filter( 'bp_send_email_delivery_class', array( $this, 'buddypress_email_delivery_class' ), 10, 4 );
10
+ }
11
+ }
12
+
13
+ public function buddypress_email_use_wp_mail( $bool ) {
14
+ return false;
15
+ }
16
+
17
+ public function buddypress_email_delivery_class( $class, $email_type, $to, $args ) {
18
+ // This will cause an error if BP_Email_Delivery is not defined.
19
+ // But the only one to apply this filter will be buddypress, and we need to declare the override before giving the class name.
20
+ if ( ! defined( 'SENDGRID_DISABLE_BUDDYPRESS' ) ) {
21
+ require_once plugin_dir_path( __FILE__ ) . 'class-buddypress-override.php';
22
+ }
23
+ return 'SendGrid_BuddyPress_Mailer';
24
+ }
25
+ }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://sendgrid.com/
4
  Tags: email, email reliability, email templates, sendgrid, smtp, transactional email, wp_mail,email infrastructure, email marketing, marketing email, deliverability, email deliverability, email delivery, email server, mail server, email integration, cloud email
5
  Requires at least: 4.2
6
  Tested up to: 4.5
7
- Stable tag: 1.9.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -195,6 +195,22 @@ Note that what is changed depends of the content-type that you have set in the s
195
 
196
  The code snippets above are usually added in the functions.php file of your theme.
197
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  == Screenshots ==
199
 
200
  1. Go to Admin Panel, section Plugins and activate the SendGrid plugin. If you want to send emails through SMTP you need to install also the 'Swift Mailer' plugin.
@@ -212,6 +228,11 @@ The code snippets above are usually added in the functions.php file of your them
212
 
213
  == Changelog ==
214
 
 
 
 
 
 
215
  = 1.9.2 =
216
  * Improved response time on admin dashboard
217
  = 1.9.1 =
@@ -326,6 +347,11 @@ The code snippets above are usually added in the functions.php file of your them
326
 
327
  == Upgrade notice ==
328
 
 
 
 
 
 
329
  = 1.9.2 =
330
  * Improved response time on admin dashboard
331
  = 1.9.1 =
4
  Tags: email, email reliability, email templates, sendgrid, smtp, transactional email, wp_mail,email infrastructure, email marketing, marketing email, deliverability, email deliverability, email delivery, email server, mail server, email integration, cloud email
5
  Requires at least: 4.2
6
  Tested up to: 4.5
7
+ Stable tag: 1.9.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
195
 
196
  The code snippets above are usually added in the functions.php file of your theme.
197
 
198
+ = Can I use this plugin with BuddyPress ? =
199
+
200
+ Yes. Our plugin required special integration with BuddyPress and it's regularly tested to ensure it behaves as expected. If you have noticed issues caused by installing this plugin along with BuddyPress, you can add the following line to your wp-config.php to disable it :
201
+
202
+ `define('SENDGRID_DISABLE_BUDDYPRESS', '1');`
203
+
204
+ = Can I use shortcodes to customize the subscription confirmation page ? =
205
+
206
+ Yes. You need to create custom page and select it from the settings page. You can place any of these shortcodes in the body of that page. Here's an example :
207
+
208
+ `Hi [sendgridSubscriptionFirstName] [sendgridSubscriptionLastName],
209
+ Your email address : [sendgridSubscriptionEmail] has been successfully added.
210
+ You'll hear from us soon!`
211
+
212
+ You need to enable the use of the First Name and Last Name fields from the settings page in order to use the shortcodes for them.
213
+
214
  == Screenshots ==
215
 
216
  1. Go to Admin Panel, section Plugins and activate the SendGrid plugin. If you want to send emails through SMTP you need to install also the 'Swift Mailer' plugin.
228
 
229
  == Changelog ==
230
 
231
+ = 1.9.3 =
232
+ * Added BuddyPress integration
233
+ * MC API Key is now saved on focusout
234
+ * Added posibility of using plain text template for subscription confirmation email
235
+ * Added posibility of adding shortcodes to subscription confirmation pages
236
  = 1.9.2 =
237
  * Improved response time on admin dashboard
238
  = 1.9.1 =
347
 
348
  == Upgrade notice ==
349
 
350
+ = 1.9.3 =
351
+ * Added BuddyPress integration
352
+ * MC API Key is now saved on focusout
353
+ * Added posibility of using plain text template for subscription confirmation email
354
+ * Added posibility of adding shortcodes to subscription confirmation pages
355
  = 1.9.2 =
356
  * Improved response time on admin dashboard
357
  = 1.9.1 =
view/js/sendgrid.settings-v1.7.3.js CHANGED
@@ -54,6 +54,7 @@ jQuery(document).ready(function($) {
54
  } else if ( $("#mc_api_key_defined_in_env").length == 0 ) {
55
  $('#mc_apikey').prop( 'disabled', false );
56
  }
 
57
  });
58
 
59
  if ( $('select#select_contact_list option').length == 0 ) {
@@ -110,4 +111,14 @@ jQuery(document).ready(function($) {
110
  }
111
  }
112
 
 
 
 
 
 
 
 
 
 
 
113
  });
54
  } else if ( $("#mc_api_key_defined_in_env").length == 0 ) {
55
  $('#mc_apikey').prop( 'disabled', false );
56
  }
57
+ $("#sendgrid_form_mc").submit();
58
  });
59
 
60
  if ( $('select#select_contact_list option').length == 0 ) {
111
  }
112
  }
113
 
114
+ // save form on unfocus mc_apikey
115
+ if ( typeof old_mc_api_key == 'undefined' ) {
116
+ old_mc_api_key = $("#mc_apikey").val();
117
+ }
118
+ $("#mc_apikey").focusout(function() {
119
+ var new_mc_api_key = $("#mc_apikey").val();
120
+ if ( old_mc_api_key != new_mc_api_key ) {
121
+ $("#sendgrid_form_mc").submit();
122
+ }
123
+ });
124
  });
view/sendgrid_settings_nlvx.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php if ( $active_tab == 'marketing' ): ?>
2
- <form class="form-table" name="sendgrid_form" method="POST" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI'] ); ?>">
3
  <table class="form-table">
4
  <tbody>
5
  <tr valign="top">
@@ -72,13 +72,21 @@
72
  </tr>
73
 
74
  <tr valign="top" class="signup_email_content">
75
- <th scope="row"> <?php _e("Signup email content:"); ?></th>
76
  <td>
77
  <textarea rows="8" cols="48" id="signup_email_content" name="sendgrid_mc_email_content" class="regular-text" <?php disabled( $is_env_mc_signup_email_content ); ?>><?php echo $mc_signup_email_content; ?></textarea>
78
  <p class="description"><?php _e('Confirmation emails must contain a verification link to confirm the email address being added.') ?> <br/> <?php _e(' You can control the placement of this link by inserting a <b>&lt;a href="%confirmation_link%"&gt; &lt;/a&gt;</b> tag in your email content. This tag is required.') ?></p>
79
  </td>
80
  </tr>
81
 
 
 
 
 
 
 
 
 
82
  <tr valign="top" class="signup_select_page">
83
  <th scope="row"> <?php _e("Signup confirmation page:"); ?></th>
84
  <td>
1
  <?php if ( $active_tab == 'marketing' ): ?>
2
+ <form class="form-table" name="sendgrid_form" id="sendgrid_form_mc" method="POST" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI'] ); ?>">
3
  <table class="form-table">
4
  <tbody>
5
  <tr valign="top">
72
  </tr>
73
 
74
  <tr valign="top" class="signup_email_content">
75
+ <th scope="row"> <?php _e("Signup email content (HTML):"); ?></th>
76
  <td>
77
  <textarea rows="8" cols="48" id="signup_email_content" name="sendgrid_mc_email_content" class="regular-text" <?php disabled( $is_env_mc_signup_email_content ); ?>><?php echo $mc_signup_email_content; ?></textarea>
78
  <p class="description"><?php _e('Confirmation emails must contain a verification link to confirm the email address being added.') ?> <br/> <?php _e(' You can control the placement of this link by inserting a <b>&lt;a href="%confirmation_link%"&gt; &lt;/a&gt;</b> tag in your email content. This tag is required.') ?></p>
79
  </td>
80
  </tr>
81
 
82
+ <tr valign="top" class="signup_email_content_text">
83
+ <th scope="row"> <?php _e("Signup email content (Plain Text):"); ?></th>
84
+ <td>
85
+ <textarea rows="8" cols="48" id="signup_email_content_text" name="sendgrid_mc_email_content_text" class="regular-text" <?php disabled( $is_env_mc_signup_email_content_text ); ?>><?php echo $mc_signup_email_content_text; ?></textarea>
86
+ <p class="description"><?php _e('Confirmation emails must contain a verification link to confirm the email address being added.') ?> <br/> <?php _e(' You can control the placement of this link by inserting a <b>%confirmation_link%</b> tag in your email content. This tag is required.') ?></p>
87
+ </td>
88
+ </tr>
89
+
90
  <tr valign="top" class="signup_select_page">
91
  <th scope="row"> <?php _e("Signup confirmation page:"); ?></th>
92
  <td>
wpsendgrid.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: SendGrid
4
  Plugin URI: http://wordpress.org/plugins/sendgrid-email-delivery-simplified/
5
  Description: Email Delivery. Simplified. SendGrid's cloud-based email infrastructure relieves businesses of the cost and complexity of maintaining custom email systems. SendGrid provides reliable delivery, scalability and real-time analytics along with flexible APIs that make custom integration a breeze.
6
- Version: 1.9.2
7
  Author: SendGrid
8
  Author URI: http://sendgrid.com
9
  Text Domain: sendgrid-email-delivery-simplified
@@ -59,6 +59,7 @@ require_once plugin_dir_path( __FILE__ ) . 'lib/class-sendgrid-statistics.php';
59
  require_once plugin_dir_path( __FILE__ ) . 'lib/sendgrid/sendgrid-wp-mail.php';
60
  require_once plugin_dir_path( __FILE__ ) . 'lib/class-sendgrid-nlvx-widget.php';
61
  require_once plugin_dir_path( __FILE__ ) . 'lib/class-sendgrid-virtual-pages.php';
 
62
 
63
  // Widget Registration
64
  if ( 'true' == Sendgrid_Tools::get_mc_auth_valid() ) {
@@ -81,4 +82,7 @@ if ( 'true' != Sendgrid_Tools::get_mc_widget_notice_dismissed() ) {
81
  new Sendgrid_Settings( plugin_basename( __FILE__ ) );
82
 
83
  // Initialize SendGrid Statistics
84
- new Sendgrid_Statistics();
 
 
 
3
  Plugin Name: SendGrid
4
  Plugin URI: http://wordpress.org/plugins/sendgrid-email-delivery-simplified/
5
  Description: Email Delivery. Simplified. SendGrid's cloud-based email infrastructure relieves businesses of the cost and complexity of maintaining custom email systems. SendGrid provides reliable delivery, scalability and real-time analytics along with flexible APIs that make custom integration a breeze.
6
+ Version: 1.9.3
7
  Author: SendGrid
8
  Author URI: http://sendgrid.com
9
  Text Domain: sendgrid-email-delivery-simplified
59
  require_once plugin_dir_path( __FILE__ ) . 'lib/sendgrid/sendgrid-wp-mail.php';
60
  require_once plugin_dir_path( __FILE__ ) . 'lib/class-sendgrid-nlvx-widget.php';
61
  require_once plugin_dir_path( __FILE__ ) . 'lib/class-sendgrid-virtual-pages.php';
62
+ require_once plugin_dir_path( __FILE__ ) . 'lib/class-sendgrid-filters.php';
63
 
64
  // Widget Registration
65
  if ( 'true' == Sendgrid_Tools::get_mc_auth_valid() ) {
82
  new Sendgrid_Settings( plugin_basename( __FILE__ ) );
83
 
84
  // Initialize SendGrid Statistics
85
+ new Sendgrid_Statistics();
86
+
87
+ // Initialize SendGrid Filters
88
+ new Sendgrid_Filters();