Kadence WooCommerce Email Designer - Version 1.1.7

Version Description

  • Fix: PHP error.
Download this release

Release Info

Developer britner
Plugin Icon 128x128 Kadence WooCommerce Email Designer
Version 1.1.7
Comparing to
See all releases

Code changes from version 1.1.6 to 1.1.7

includes/class-kadence-woomail-preview.php CHANGED
@@ -540,6 +540,10 @@ if ( ! class_exists( 'Kadence_Woomail_Preview' ) ) {
540
  $scripts .= 'var pl_customer_first_name = "' . self::$current_order->get_billing_first_name() . '";';
541
  $scripts .= 'var pl_customer_last_name = "' . self::$current_order->get_billing_last_name() . '";';
542
  $scripts .= 'var pl_customer_full_name = "' . self::$current_order->get_formatted_billing_full_name() . '";';
 
 
 
 
543
  }
544
  $scripts .= 'var pl_product_title = "' . self::$current_product_title . '";';
545
  // Function to handle special cases.
@@ -568,6 +572,8 @@ if ( ! class_exists( 'Kadence_Woomail_Preview' ) ) {
568
  value = value.replace('{order_number}', pl_order_number);
569
  } else if (value && value.includes('{customer_first_name}') ) {
570
  value = value.replace('{customer_first_name}', pl_customer_first_name);
 
 
571
  } else if (value && value.includes('{customer_last_name}') ) {
572
  value = value.replace('{customer_last_name}', pl_customer_last_name);
573
  } else if (value && value.includes('{customer_full_name}') ) {
540
  $scripts .= 'var pl_customer_first_name = "' . self::$current_order->get_billing_first_name() . '";';
541
  $scripts .= 'var pl_customer_last_name = "' . self::$current_order->get_billing_last_name() . '";';
542
  $scripts .= 'var pl_customer_full_name = "' . self::$current_order->get_formatted_billing_full_name() . '";';
543
+ if ( 0 === ( $user_id = (int) get_post_meta( self::$current_order->get_id(), '_customer_user', true ) ) ) {
544
+ $user_id = get_current_user_id();
545
+ }
546
+ $scripts .= 'var pl_customer_username = "' . Kadence_Woomail_Designer::get_username_from_id( $user_id ) . '";';
547
  }
548
  $scripts .= 'var pl_product_title = "' . self::$current_product_title . '";';
549
  // Function to handle special cases.
572
  value = value.replace('{order_number}', pl_order_number);
573
  } else if (value && value.includes('{customer_first_name}') ) {
574
  value = value.replace('{customer_first_name}', pl_customer_first_name);
575
+ } else if (value && value.includes('{customer_username}') ) {
576
+ value = value.replace('{customer_username}', pl_customer_username);
577
  } else if (value && value.includes('{customer_last_name}') ) {
578
  value = value.replace('{customer_last_name}', pl_customer_last_name);
579
  } else if (value && value.includes('{customer_full_name}') ) {
kadence-woocommerce-email-designer.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Kadence WooCommerce Email Designer
4
  * Plugin URI: http://kadencethemes.com/products/woocommerce-email-designer/
5
  * Description: Customize the default woocommerce email templates design and text through the native WordPress customizer. Preview emails and send test emails.
6
- * Version: 1.1.6
7
  * Author: Kadence Themes
8
  * Author URI: http://kadencethemes.com/
9
  * License: GPLv2 or later
@@ -53,7 +53,7 @@ class Kadence_Woomail_Designer {
53
 
54
  define( 'KT_WOOMAIL_PATH', realpath( plugin_dir_path( __FILE__ ) ) . DIRECTORY_SEPARATOR );
55
  define( 'KT_WOOMAIL_URL', plugin_dir_url( __FILE__ ) );
56
- define( 'KT_WOOMAIL_VERSION', '1.1.6' );
57
 
58
  if ( ! kadence_woomail_is_woo_active() ) {
59
  add_action( 'admin_notices', array( $this, 'admin_notice_need_woocommerce' ) );
@@ -281,7 +281,7 @@ class Kadence_Woomail_Designer {
281
  $body_text = str_replace( '{customer_first_name}', $order->get_billing_first_name(), $body_text );
282
  $body_text = str_replace( '{customer_last_name}', $order->get_billing_last_name(), $body_text );
283
  $body_text = str_replace( '{customer_full_name}', $order->get_formatted_billing_full_name(), $body_text );
284
- $body_text = str_replace( '{customer_username}', $this->get_username_from_id( $user_id ), $body_text );
285
  }
286
 
287
  $body_text = apply_filters( 'kadence_woomail_order_body_text', $body_text, $order, $sent_to_admin, $plain_text, $email );
@@ -292,7 +292,7 @@ class Kadence_Woomail_Designer {
292
  echo wp_kses_post( $body_text );
293
 
294
  }
295
- public function get_username_from_id( $id ) {
296
  if ( empty( $id ) || 'guest' === $id ) {
297
  return __( 'Guest', 'kadence-woocommerce-email-designer' );
298
  }
@@ -345,7 +345,7 @@ class Kadence_Woomail_Designer {
345
  $subtitle = str_replace( '{customer_first_name}', $email->object->get_billing_first_name(), $subtitle );
346
  $subtitle = str_replace( '{customer_last_name}', $email->object->get_billing_last_name(), $subtitle );
347
  $subtitle = str_replace( '{customer_full_name}', $email->object->get_formatted_billing_full_name(), $subtitle );
348
- $subtitle = str_replace( '{customer_username}', $this->get_username_from_id( $user_id ), $subtitle );
349
  } elseif ( is_a( $email->object, 'WC_Product' ) ) {
350
  $subtitle = str_replace( '{product_title}', $email->object->get_title(), $subtitle );
351
  }
@@ -442,7 +442,7 @@ class Kadence_Woomail_Designer {
442
  $string = str_replace( '{customer_first_name}', $email->object->get_billing_first_name(), $string );
443
  $string = str_replace( '{customer_last_name}', $email->object->get_billing_last_name(), $string );
444
  $string = str_replace( '{customer_full_name}', $email->object->get_formatted_billing_full_name(), $string );
445
- $string = str_replace( '{customer_username}', $this->get_username_from_id( $user_id ), $string );
446
  }
447
 
448
  return $string;
3
  * Plugin Name: Kadence WooCommerce Email Designer
4
  * Plugin URI: http://kadencethemes.com/products/woocommerce-email-designer/
5
  * Description: Customize the default woocommerce email templates design and text through the native WordPress customizer. Preview emails and send test emails.
6
+ * Version: 1.1.7
7
  * Author: Kadence Themes
8
  * Author URI: http://kadencethemes.com/
9
  * License: GPLv2 or later
53
 
54
  define( 'KT_WOOMAIL_PATH', realpath( plugin_dir_path( __FILE__ ) ) . DIRECTORY_SEPARATOR );
55
  define( 'KT_WOOMAIL_URL', plugin_dir_url( __FILE__ ) );
56
+ define( 'KT_WOOMAIL_VERSION', '1.1.7' );
57
 
58
  if ( ! kadence_woomail_is_woo_active() ) {
59
  add_action( 'admin_notices', array( $this, 'admin_notice_need_woocommerce' ) );
281
  $body_text = str_replace( '{customer_first_name}', $order->get_billing_first_name(), $body_text );
282
  $body_text = str_replace( '{customer_last_name}', $order->get_billing_last_name(), $body_text );
283
  $body_text = str_replace( '{customer_full_name}', $order->get_formatted_billing_full_name(), $body_text );
284
+ $body_text = str_replace( '{customer_username}', Kadence_Woomail_Designer::get_username_from_id( $user_id ), $body_text );
285
  }
286
 
287
  $body_text = apply_filters( 'kadence_woomail_order_body_text', $body_text, $order, $sent_to_admin, $plain_text, $email );
292
  echo wp_kses_post( $body_text );
293
 
294
  }
295
+ public static function get_username_from_id( $id ) {
296
  if ( empty( $id ) || 'guest' === $id ) {
297
  return __( 'Guest', 'kadence-woocommerce-email-designer' );
298
  }
345
  $subtitle = str_replace( '{customer_first_name}', $email->object->get_billing_first_name(), $subtitle );
346
  $subtitle = str_replace( '{customer_last_name}', $email->object->get_billing_last_name(), $subtitle );
347
  $subtitle = str_replace( '{customer_full_name}', $email->object->get_formatted_billing_full_name(), $subtitle );
348
+ $subtitle = str_replace( '{customer_username}', Kadence_Woomail_Designer::get_username_from_id( $user_id ), $subtitle );
349
  } elseif ( is_a( $email->object, 'WC_Product' ) ) {
350
  $subtitle = str_replace( '{product_title}', $email->object->get_title(), $subtitle );
351
  }
442
  $string = str_replace( '{customer_first_name}', $email->object->get_billing_first_name(), $string );
443
  $string = str_replace( '{customer_last_name}', $email->object->get_billing_last_name(), $string );
444
  $string = str_replace( '{customer_full_name}', $email->object->get_formatted_billing_full_name(), $string );
445
+ $string = str_replace( '{customer_username}', Kadence_Woomail_Designer::get_username_from_id( $user_id ), $string );
446
  }
447
 
448
  return $string;
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: https://www.kadencethemes.com/about-us/
5
  Requires PHP: 5.2.4
6
  Requires at least: 4.4
7
  Tested up to: 5.1.1
8
- Stable tag: 1.1.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -60,6 +60,9 @@ Install the plugin into the `/wp-content/plugins/` folder, and activate it.
60
 
61
  == Changelog ==
62
 
 
 
 
63
  = 1.1.6 =
64
  * Add: Username placeholder for some emails.
65
  * Add: Flatsome Support.
5
  Requires PHP: 5.2.4
6
  Requires at least: 4.4
7
  Tested up to: 5.1.1
8
+ Stable tag: 1.1.7
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
60
 
61
  == Changelog ==
62
 
63
+ = 1.1.7 =
64
+ * Fix: PHP error.
65
+
66
  = 1.1.6 =
67
  * Add: Username placeholder for some emails.
68
  * Add: Flatsome Support.