Version Description
- Update: Fix bug in plan text email.
- Update: Add $email default to prevent some fatal errors with plugins using non standard email templates.
Download this release
Release Info
Developer | britner |
Plugin | Kadence WooCommerce Email Designer |
Version | 1.3.8 |
Comparing to | |
See all releases |
Code changes from version 1.3.7 to 1.3.8
- kadence-woocommerce-email-designer.php +68 -34
- languages/kadence-woocommerce-email-designer.pot +13 -13
- readme.txt +6 -2
kadence-woocommerce-email-designer.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Kadence WooCommerce Email Designer
|
4 |
* Plugin URI: http://kadencewp.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.3.
|
7 |
* Author: Kadence WP
|
8 |
* Author URI: http://kadencewp.com/
|
9 |
* License: GPLv2 or later
|
@@ -59,13 +59,13 @@ class Kadence_Woomail_Designer {
|
|
59 |
|
60 |
define( 'KT_WOOMAIL_PATH', realpath( plugin_dir_path( __FILE__ ) ) . DIRECTORY_SEPARATOR );
|
61 |
define( 'KT_WOOMAIL_URL', plugin_dir_url( __FILE__ ) );
|
62 |
-
define( 'KT_WOOMAIL_VERSION', '1.3.
|
63 |
|
64 |
if ( ! kadence_woomail_is_woo_active() ) {
|
65 |
add_action( 'admin_notices', array( $this, 'admin_notice_need_woocommerce' ) );
|
66 |
return;
|
67 |
}
|
68 |
-
require_once KT_WOOMAIL_PATH . 'includes/class-kadence-woomail-settings.php'; //Gets all settings.
|
69 |
require_once KT_WOOMAIL_PATH . 'includes/class-kadence-woomail-customizer.php'; // Gets custom customzier set up.
|
70 |
require_once KT_WOOMAIL_PATH . 'includes/class-kadence-woomail-import-export.php'; // Adds Customizer control.
|
71 |
require_once KT_WOOMAIL_PATH . 'includes/class-customizer-range-value-control.php'; // Adds Customizer control.
|
@@ -126,16 +126,27 @@ class Kadence_Woomail_Designer {
|
|
126 |
|
127 |
add_filter( 'woocommerce_email_restore_locale', array( $this, 'restore_to_user_locale' ) );
|
128 |
|
129 |
-
add_filter( '
|
130 |
|
131 |
-
//require_once KT_WOOMAIL_PATH . 'includes/class-kwed-cartflows-ca-email.php'; // Add CartFlows.
|
132 |
|
133 |
}
|
134 |
/**
|
135 |
-
*
|
136 |
*
|
137 |
-
* @param string $
|
138 |
-
* @
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
*/
|
140 |
public function add_gmail_hack( $content ) {
|
141 |
$responsive_check = Kadence_Woomail_Customizer::opt( 'responsive_mode' );
|
@@ -172,7 +183,7 @@ class Kadence_Woomail_Designer {
|
|
172 |
*/
|
173 |
public function admin_notice_need_woocommerce() {
|
174 |
echo '<div class="notice notice-error is-dismissible">';
|
175 |
-
echo '<p>' .
|
176 |
echo '</div>';
|
177 |
}
|
178 |
/**
|
@@ -198,7 +209,7 @@ class Kadence_Woomail_Designer {
|
|
198 |
<?php
|
199 |
$items = count( $social_links );
|
200 |
foreach ( $social_links as $social_link ) {
|
201 |
-
echo '<td valign="middle" style="text-align:center; width:' . round( 100 / $items, 2 ) . '%">';
|
202 |
echo '<a href="' . esc_url( $social_link->link ) . '" class="ft-social-link" style="display:block; text-decoration: none;">';
|
203 |
if ( 'customizer_repeater_image' == $social_link->choice ) {
|
204 |
echo '<img src="' . esc_attr( $social_link->image_url ) . '" width="24" style="vertical-align: bottom;">';
|
@@ -226,7 +237,7 @@ class Kadence_Woomail_Designer {
|
|
226 |
<table border="0" cellpadding="10" cellspacing="0" width="100%">
|
227 |
<tr>
|
228 |
<td colspan="2" valign="middle" id="credit">
|
229 |
-
<?php echo
|
230 |
</td>
|
231 |
</tr>
|
232 |
</table>
|
@@ -264,12 +275,15 @@ class Kadence_Woomail_Designer {
|
|
264 |
/**
|
265 |
* Hook in main text areas for customized emails
|
266 |
*
|
267 |
-
* @
|
|
|
|
|
|
|
268 |
* @return void
|
269 |
*/
|
270 |
public function email_main_text_area( $order, $sent_to_admin, $plain_text, $email ) {
|
271 |
|
272 |
-
// Get Email ID
|
273 |
$key = $email->id;
|
274 |
if ( 'customer_refunded_order' == $key ) {
|
275 |
if ( $email->partial_refund ) {
|
@@ -280,8 +294,8 @@ class Kadence_Woomail_Designer {
|
|
280 |
} elseif ( 'customer_partially_refunded_order' == $key ) {
|
281 |
$body_text = Kadence_Woomail_Customizer::opt( 'customer_refunded_order_body_partial' );
|
282 |
} elseif ( 'customer_invoice' == $key ) {
|
283 |
-
if( $order->has_status( 'pending' ) ) {
|
284 |
-
$body_text = Kadence_Woomail_Customizer::opt( $key.'_body' );
|
285 |
$btn_switch = Kadence_Woomail_Customizer::opt( $key . '_btn_switch' );
|
286 |
if ( true == $btn_switch ) {
|
287 |
$pay_link = '<p class="btn-container"><a class="btn" href="' . esc_url( $order->get_checkout_payment_url() ) . '">' . esc_html__( 'Pay for this order', 'kadence-woocommerce-email-designer' ) . '</a></p>';
|
@@ -290,11 +304,11 @@ class Kadence_Woomail_Designer {
|
|
290 |
}
|
291 |
$body_text = str_replace( '{invoice_pay_link}', $pay_link, $body_text );
|
292 |
} else {
|
293 |
-
$body_text = Kadence_Woomail_Customizer::opt( $key.'_body_paid' );
|
294 |
}
|
295 |
} elseif ( 'customer_renewal_invoice' == $key ) {
|
296 |
-
if( $order->has_status( 'pending' ) ) {
|
297 |
-
$body_text = Kadence_Woomail_Customizer::opt( $key.'_body' );
|
298 |
$btn_switch = Kadence_Woomail_Customizer::opt( $key . '_btn_switch' );
|
299 |
if ( true == $btn_switch ) {
|
300 |
$pay_link = '<p class="btn-container"><a class="btn" href="' . esc_url( $order->get_checkout_payment_url() ) . '">' . esc_html__( 'Pay Now »', 'kadence-woocommerce-email-designer' ) . '</a></p>';
|
@@ -303,7 +317,7 @@ class Kadence_Woomail_Designer {
|
|
303 |
}
|
304 |
$body_text = str_replace( '{invoice_pay_link}', $pay_link, $body_text );
|
305 |
} else {
|
306 |
-
$body_text = Kadence_Woomail_Customizer::opt( $key.'_body_failed' );
|
307 |
$btn_switch = Kadence_Woomail_Customizer::opt( $key . '_btn_switch' );
|
308 |
if ( true == $btn_switch ) {
|
309 |
$pay_link = '<p class="btn-container"><a class="btn" href="' . esc_url( $order->get_checkout_payment_url() ) . '">' . esc_html__( 'Pay Now »', 'kadence-woocommerce-email-designer' ) . '</a></p>';
|
@@ -320,7 +334,7 @@ class Kadence_Woomail_Designer {
|
|
320 |
if ( 0 === ( $user_id = (int) get_post_meta( $order->get_id(), '_customer_user', true ) ) ) {
|
321 |
$user_id = 'guest';
|
322 |
}
|
323 |
-
// Check for placeholders
|
324 |
$body_text = str_replace( '{order_date}', wc_format_datetime( $order->get_date_created() ), $body_text );
|
325 |
$body_text = str_replace( '{order_number}', $order->get_order_number(), $body_text );
|
326 |
$body_text = str_replace( '{customer_first_name}', $order->get_billing_first_name(), $body_text );
|
@@ -332,12 +346,19 @@ class Kadence_Woomail_Designer {
|
|
332 |
|
333 |
$body_text = apply_filters( 'kadence_woomail_order_body_text', $body_text, $order, $sent_to_admin, $plain_text, $email );
|
334 |
|
335 |
-
// auto wrap text
|
336 |
$body_text = wpautop( $body_text );
|
337 |
|
338 |
echo wp_kses_post( $body_text );
|
339 |
|
340 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
public static function get_username_from_id( $id ) {
|
342 |
if ( empty( $id ) || 'guest' === $id ) {
|
343 |
return __( 'Guest', 'kadence-woocommerce-email-designer' );
|
@@ -353,8 +374,10 @@ class Kadence_Woomail_Designer {
|
|
353 |
/**
|
354 |
* Filter Subtitle for Placeholders
|
355 |
*
|
|
|
|
|
356 |
* @access public
|
357 |
-
* @return
|
358 |
*/
|
359 |
public static function filter_subtitle( $subtitle, $email ) {
|
360 |
// Check for placeholders.
|
@@ -380,7 +403,7 @@ class Kadence_Woomail_Designer {
|
|
380 |
$subtitle = str_replace( '{customer_first_name}', $first_name, $subtitle );
|
381 |
$subtitle = str_replace( '{customer_last_name}', $last_name, $subtitle );
|
382 |
$subtitle = str_replace( '{customer_full_name}', $full_name, $subtitle );
|
383 |
-
$subtitle = str_replace( '{customer_username}',
|
384 |
|
385 |
} elseif ( is_a( $email->object, 'WC_Order' ) ) {
|
386 |
if ( 0 === ( $user_id = (int) get_post_meta( $email->object->get_id(), '_customer_user', true ) ) ) {
|
@@ -404,16 +427,17 @@ class Kadence_Woomail_Designer {
|
|
404 |
/**
|
405 |
* Hook in main text areas for customized emails.
|
406 |
*
|
|
|
407 |
* @access public
|
408 |
* @return void
|
409 |
*/
|
410 |
public function email_main_text_area_no_order( $email ) {
|
411 |
|
412 |
-
// Get Email ID
|
413 |
$key = $email->id;
|
414 |
|
415 |
$body_text = Kadence_Woomail_Customizer::opt( $key . '_body' );
|
416 |
-
// Check for placeholders
|
417 |
$body_text = str_replace( '{site_title}', get_bloginfo( 'name', 'display' ), $body_text );
|
418 |
if ( is_a( $email->object, 'WP_User' ) ) {
|
419 |
|
@@ -421,7 +445,7 @@ class Kadence_Woomail_Designer {
|
|
421 |
if ( empty( $first_name ) ) {
|
422 |
$first_name = get_user_meta( $email->object->ID, 'first_name', true );
|
423 |
if ( empty( $first_name ) ) {
|
424 |
-
// Fall back to user display name
|
425 |
$first_name = $email->object->display_name;
|
426 |
}
|
427 |
}
|
@@ -430,20 +454,20 @@ class Kadence_Woomail_Designer {
|
|
430 |
if ( empty( $last_name ) ) {
|
431 |
$last_name = get_user_meta( $email->object->ID, 'last_name', true );
|
432 |
if ( empty( $last_name ) ) {
|
433 |
-
// Fall back to user display name
|
434 |
$last_name = $email->object->display_name;
|
435 |
}
|
436 |
}
|
437 |
|
438 |
$full_name = get_user_meta( $email->object->ID, 'formatted_billing_full_name', true );
|
439 |
-
if( empty( $full_name ) ) {
|
440 |
-
// Fall back to user display name
|
441 |
$full_name = $email->object->display_name;
|
442 |
}
|
443 |
$body_text = str_replace( '{customer_first_name}', $first_name, $body_text );
|
444 |
$body_text = str_replace( '{customer_last_name}', $last_name, $body_text );
|
445 |
$body_text = str_replace( '{customer_full_name}', $full_name, $body_text );
|
446 |
-
$body_text = str_replace( '{customer_username}',
|
447 |
} elseif ( is_a( $email->object, 'WC_Product' ) ) {
|
448 |
$body_text = str_replace( '{product_title}', $email->object->get_title(), $body_text );
|
449 |
$body_text = str_replace( '{product_link}', $email->object->get_permalink(), $body_text );
|
@@ -461,6 +485,8 @@ class Kadence_Woomail_Designer {
|
|
461 |
/**
|
462 |
* Filter through strings to add support for extra placeholders
|
463 |
*
|
|
|
|
|
464 |
* @access public
|
465 |
* @return string
|
466 |
*/
|
@@ -503,7 +529,7 @@ class Kadence_Woomail_Designer {
|
|
503 |
$string = str_replace( '{customer_last_name}', $email->object->get_billing_last_name(), $string );
|
504 |
$string = str_replace( '{customer_full_name}', $email->object->get_formatted_billing_full_name(), $string );
|
505 |
$string = str_replace( '{customer_company}', $email->object->get_billing_company(), $string );
|
506 |
-
$string = str_replace( '{customer_username}',
|
507 |
}
|
508 |
|
509 |
return $string;
|
@@ -556,7 +582,7 @@ class Kadence_Woomail_Designer {
|
|
556 |
* @return bool
|
557 |
*/
|
558 |
public static function is_own_customizer_request() {
|
559 |
-
return isset( $_REQUEST['kt-woomail-customize'] ) && $_REQUEST['kt-woomail-customize']
|
560 |
}
|
561 |
|
562 |
/**
|
@@ -588,16 +614,21 @@ class Kadence_Woomail_Designer {
|
|
588 |
/**
|
589 |
* Hook in email header with access to the email object
|
590 |
*
|
|
|
|
|
591 |
* @access public
|
592 |
-
* @return
|
593 |
*/
|
594 |
-
public function add_email_header( $email_heading, $email ) {
|
595 |
wc_get_template( 'emails/email-header.php', array( 'email_heading' => $email_heading, 'email' => $email ) );
|
596 |
}
|
597 |
|
598 |
/**
|
599 |
* Filter in custom email templates with priority to child themes
|
600 |
*
|
|
|
|
|
|
|
601 |
* @access public
|
602 |
* @return string
|
603 |
*/
|
@@ -638,6 +669,9 @@ class Kadence_Woomail_Designer {
|
|
638 |
/**
|
639 |
* Filter in custom email templates with priority to child themes
|
640 |
*
|
|
|
|
|
|
|
641 |
* @access public
|
642 |
* @return string
|
643 |
*/
|
3 |
* Plugin Name: Kadence WooCommerce Email Designer
|
4 |
* Plugin URI: http://kadencewp.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.3.8
|
7 |
* Author: Kadence WP
|
8 |
* Author URI: http://kadencewp.com/
|
9 |
* License: GPLv2 or later
|
59 |
|
60 |
define( 'KT_WOOMAIL_PATH', realpath( plugin_dir_path( __FILE__ ) ) . DIRECTORY_SEPARATOR );
|
61 |
define( 'KT_WOOMAIL_URL', plugin_dir_url( __FILE__ ) );
|
62 |
+
define( 'KT_WOOMAIL_VERSION', '1.3.8' );
|
63 |
|
64 |
if ( ! kadence_woomail_is_woo_active() ) {
|
65 |
add_action( 'admin_notices', array( $this, 'admin_notice_need_woocommerce' ) );
|
66 |
return;
|
67 |
}
|
68 |
+
require_once KT_WOOMAIL_PATH . 'includes/class-kadence-woomail-settings.php'; // Gets all settings.
|
69 |
require_once KT_WOOMAIL_PATH . 'includes/class-kadence-woomail-customizer.php'; // Gets custom customzier set up.
|
70 |
require_once KT_WOOMAIL_PATH . 'includes/class-kadence-woomail-import-export.php'; // Adds Customizer control.
|
71 |
require_once KT_WOOMAIL_PATH . 'includes/class-customizer-range-value-control.php'; // Adds Customizer control.
|
126 |
|
127 |
add_filter( 'woocommerce_email_restore_locale', array( $this, 'restore_to_user_locale' ) );
|
128 |
|
129 |
+
add_filter( 'woocommerce_email_styles', array( $this, 'check_to_add_gmail_hack' ), 50, 2 );
|
130 |
|
131 |
+
//require_once KT_WOOMAIL_PATH . 'includes/class-kwed-cartflows-ca-email.php'; // Add CartFlows, soon.
|
132 |
|
133 |
}
|
134 |
/**
|
135 |
+
* Adds the filter for email hack if this filter runs.
|
136 |
*
|
137 |
+
* @param string $css the Email css.
|
138 |
+
* @param object $email the Email object.
|
139 |
+
* @return string the Email css.
|
140 |
+
*/
|
141 |
+
public function check_to_add_gmail_hack( $css, $email ) {
|
142 |
+
add_filter( 'woocommerce_mail_content', array( $this, 'add_gmail_hack' ), 50 );
|
143 |
+
return $css;
|
144 |
+
}
|
145 |
+
/**
|
146 |
+
* Adds a bit of css to fix a rendering issue where gmail breaks email templates.
|
147 |
+
*
|
148 |
+
* @param string $content the Email content.
|
149 |
+
* @return string Email content with string possibly added on.
|
150 |
*/
|
151 |
public function add_gmail_hack( $content ) {
|
152 |
$responsive_check = Kadence_Woomail_Customizer::opt( 'responsive_mode' );
|
183 |
*/
|
184 |
public function admin_notice_need_woocommerce() {
|
185 |
echo '<div class="notice notice-error is-dismissible">';
|
186 |
+
echo '<p>' . esc_html__( 'Kadence Woocommerce Email Designer requires WooCommerce to be active to work', 'kadence-woocommerce-email-designer' ) . '</p>';
|
187 |
echo '</div>';
|
188 |
}
|
189 |
/**
|
209 |
<?php
|
210 |
$items = count( $social_links );
|
211 |
foreach ( $social_links as $social_link ) {
|
212 |
+
echo '<td valign="middle" style="text-align:center; width:' . esc_attr( round( 100 / $items, 2 ) ) . '%">';
|
213 |
echo '<a href="' . esc_url( $social_link->link ) . '" class="ft-social-link" style="display:block; text-decoration: none;">';
|
214 |
if ( 'customizer_repeater_image' == $social_link->choice ) {
|
215 |
echo '<img src="' . esc_attr( $social_link->image_url ) . '" width="24" style="vertical-align: bottom;">';
|
237 |
<table border="0" cellpadding="10" cellspacing="0" width="100%">
|
238 |
<tr>
|
239 |
<td colspan="2" valign="middle" id="credit">
|
240 |
+
<?php echo wp_kses_post( wpautop( wptexturize( apply_filters( 'woocommerce_email_footer_text', get_option( 'woocommerce_email_footer_text' ) ) ) ) ); ?>
|
241 |
</td>
|
242 |
</tr>
|
243 |
</table>
|
275 |
/**
|
276 |
* Hook in main text areas for customized emails
|
277 |
*
|
278 |
+
* @param object $order the order object.
|
279 |
+
* @param boolean $sent_to_admin if sent to admin.
|
280 |
+
* @param boolean $plain_text if plan text.
|
281 |
+
* @param object $email the Email object.
|
282 |
* @return void
|
283 |
*/
|
284 |
public function email_main_text_area( $order, $sent_to_admin, $plain_text, $email ) {
|
285 |
|
286 |
+
// Get Email ID.
|
287 |
$key = $email->id;
|
288 |
if ( 'customer_refunded_order' == $key ) {
|
289 |
if ( $email->partial_refund ) {
|
294 |
} elseif ( 'customer_partially_refunded_order' == $key ) {
|
295 |
$body_text = Kadence_Woomail_Customizer::opt( 'customer_refunded_order_body_partial' );
|
296 |
} elseif ( 'customer_invoice' == $key ) {
|
297 |
+
if ( $order->has_status( 'pending' ) ) {
|
298 |
+
$body_text = Kadence_Woomail_Customizer::opt( $key . '_body' );
|
299 |
$btn_switch = Kadence_Woomail_Customizer::opt( $key . '_btn_switch' );
|
300 |
if ( true == $btn_switch ) {
|
301 |
$pay_link = '<p class="btn-container"><a class="btn" href="' . esc_url( $order->get_checkout_payment_url() ) . '">' . esc_html__( 'Pay for this order', 'kadence-woocommerce-email-designer' ) . '</a></p>';
|
304 |
}
|
305 |
$body_text = str_replace( '{invoice_pay_link}', $pay_link, $body_text );
|
306 |
} else {
|
307 |
+
$body_text = Kadence_Woomail_Customizer::opt( $key . '_body_paid' );
|
308 |
}
|
309 |
} elseif ( 'customer_renewal_invoice' == $key ) {
|
310 |
+
if ( $order->has_status( 'pending' ) ) {
|
311 |
+
$body_text = Kadence_Woomail_Customizer::opt( $key . '_body' );
|
312 |
$btn_switch = Kadence_Woomail_Customizer::opt( $key . '_btn_switch' );
|
313 |
if ( true == $btn_switch ) {
|
314 |
$pay_link = '<p class="btn-container"><a class="btn" href="' . esc_url( $order->get_checkout_payment_url() ) . '">' . esc_html__( 'Pay Now »', 'kadence-woocommerce-email-designer' ) . '</a></p>';
|
317 |
}
|
318 |
$body_text = str_replace( '{invoice_pay_link}', $pay_link, $body_text );
|
319 |
} else {
|
320 |
+
$body_text = Kadence_Woomail_Customizer::opt( $key . '_body_failed' );
|
321 |
$btn_switch = Kadence_Woomail_Customizer::opt( $key . '_btn_switch' );
|
322 |
if ( true == $btn_switch ) {
|
323 |
$pay_link = '<p class="btn-container"><a class="btn" href="' . esc_url( $order->get_checkout_payment_url() ) . '">' . esc_html__( 'Pay Now »', 'kadence-woocommerce-email-designer' ) . '</a></p>';
|
334 |
if ( 0 === ( $user_id = (int) get_post_meta( $order->get_id(), '_customer_user', true ) ) ) {
|
335 |
$user_id = 'guest';
|
336 |
}
|
337 |
+
// Check for placeholders.
|
338 |
$body_text = str_replace( '{order_date}', wc_format_datetime( $order->get_date_created() ), $body_text );
|
339 |
$body_text = str_replace( '{order_number}', $order->get_order_number(), $body_text );
|
340 |
$body_text = str_replace( '{customer_first_name}', $order->get_billing_first_name(), $body_text );
|
346 |
|
347 |
$body_text = apply_filters( 'kadence_woomail_order_body_text', $body_text, $order, $sent_to_admin, $plain_text, $email );
|
348 |
|
349 |
+
// auto wrap text.
|
350 |
$body_text = wpautop( $body_text );
|
351 |
|
352 |
echo wp_kses_post( $body_text );
|
353 |
|
354 |
}
|
355 |
+
/**
|
356 |
+
* Get username from user id.
|
357 |
+
*
|
358 |
+
* @param string $id the user id.
|
359 |
+
* @access public
|
360 |
+
* @return string
|
361 |
+
*/
|
362 |
public static function get_username_from_id( $id ) {
|
363 |
if ( empty( $id ) || 'guest' === $id ) {
|
364 |
return __( 'Guest', 'kadence-woocommerce-email-designer' );
|
374 |
/**
|
375 |
* Filter Subtitle for Placeholders
|
376 |
*
|
377 |
+
* @param string $subtitle the email subtitle.
|
378 |
+
* @param object $email the email object.
|
379 |
* @access public
|
380 |
+
* @return string
|
381 |
*/
|
382 |
public static function filter_subtitle( $subtitle, $email ) {
|
383 |
// Check for placeholders.
|
403 |
$subtitle = str_replace( '{customer_first_name}', $first_name, $subtitle );
|
404 |
$subtitle = str_replace( '{customer_last_name}', $last_name, $subtitle );
|
405 |
$subtitle = str_replace( '{customer_full_name}', $full_name, $subtitle );
|
406 |
+
$subtitle = str_replace( '{customer_username}', $email->user_login, $subtitle );
|
407 |
|
408 |
} elseif ( is_a( $email->object, 'WC_Order' ) ) {
|
409 |
if ( 0 === ( $user_id = (int) get_post_meta( $email->object->get_id(), '_customer_user', true ) ) ) {
|
427 |
/**
|
428 |
* Hook in main text areas for customized emails.
|
429 |
*
|
430 |
+
* @param object $email the email object.
|
431 |
* @access public
|
432 |
* @return void
|
433 |
*/
|
434 |
public function email_main_text_area_no_order( $email ) {
|
435 |
|
436 |
+
// Get Email ID.
|
437 |
$key = $email->id;
|
438 |
|
439 |
$body_text = Kadence_Woomail_Customizer::opt( $key . '_body' );
|
440 |
+
// Check for placeholders.
|
441 |
$body_text = str_replace( '{site_title}', get_bloginfo( 'name', 'display' ), $body_text );
|
442 |
if ( is_a( $email->object, 'WP_User' ) ) {
|
443 |
|
445 |
if ( empty( $first_name ) ) {
|
446 |
$first_name = get_user_meta( $email->object->ID, 'first_name', true );
|
447 |
if ( empty( $first_name ) ) {
|
448 |
+
// Fall back to user display name.
|
449 |
$first_name = $email->object->display_name;
|
450 |
}
|
451 |
}
|
454 |
if ( empty( $last_name ) ) {
|
455 |
$last_name = get_user_meta( $email->object->ID, 'last_name', true );
|
456 |
if ( empty( $last_name ) ) {
|
457 |
+
// Fall back to user display name.
|
458 |
$last_name = $email->object->display_name;
|
459 |
}
|
460 |
}
|
461 |
|
462 |
$full_name = get_user_meta( $email->object->ID, 'formatted_billing_full_name', true );
|
463 |
+
if ( empty( $full_name ) ) {
|
464 |
+
// Fall back to user display name.
|
465 |
$full_name = $email->object->display_name;
|
466 |
}
|
467 |
$body_text = str_replace( '{customer_first_name}', $first_name, $body_text );
|
468 |
$body_text = str_replace( '{customer_last_name}', $last_name, $body_text );
|
469 |
$body_text = str_replace( '{customer_full_name}', $full_name, $body_text );
|
470 |
+
$body_text = str_replace( '{customer_username}', $email->user_login, $body_text );
|
471 |
} elseif ( is_a( $email->object, 'WC_Product' ) ) {
|
472 |
$body_text = str_replace( '{product_title}', $email->object->get_title(), $body_text );
|
473 |
$body_text = str_replace( '{product_link}', $email->object->get_permalink(), $body_text );
|
485 |
/**
|
486 |
* Filter through strings to add support for extra placeholders
|
487 |
*
|
488 |
+
* @param string $string string of text.
|
489 |
+
* @param object $email the email object.
|
490 |
* @access public
|
491 |
* @return string
|
492 |
*/
|
529 |
$string = str_replace( '{customer_last_name}', $email->object->get_billing_last_name(), $string );
|
530 |
$string = str_replace( '{customer_full_name}', $email->object->get_formatted_billing_full_name(), $string );
|
531 |
$string = str_replace( '{customer_company}', $email->object->get_billing_company(), $string );
|
532 |
+
$string = str_replace( '{customer_username}', self::get_username_from_id( $user_id ), $string );
|
533 |
}
|
534 |
|
535 |
return $string;
|
582 |
* @return bool
|
583 |
*/
|
584 |
public static function is_own_customizer_request() {
|
585 |
+
return isset( $_REQUEST['kt-woomail-customize'] ) && '1' === $_REQUEST['kt-woomail-customize'];
|
586 |
}
|
587 |
|
588 |
/**
|
614 |
/**
|
615 |
* Hook in email header with access to the email object
|
616 |
*
|
617 |
+
* @param string $email_heading email heading.
|
618 |
+
* @param object $email the email object.
|
619 |
* @access public
|
620 |
+
* @return void
|
621 |
*/
|
622 |
+
public function add_email_header( $email_heading, $email = '' ) {
|
623 |
wc_get_template( 'emails/email-header.php', array( 'email_heading' => $email_heading, 'email' => $email ) );
|
624 |
}
|
625 |
|
626 |
/**
|
627 |
* Filter in custom email templates with priority to child themes
|
628 |
*
|
629 |
+
* @param string $template the email template file.
|
630 |
+
* @param string $template_name name of email template.
|
631 |
+
* @param string $template_path path to email template.
|
632 |
* @access public
|
633 |
* @return string
|
634 |
*/
|
669 |
/**
|
670 |
* Filter in custom email templates with priority to child themes
|
671 |
*
|
672 |
+
* @param string $template the email template file.
|
673 |
+
* @param string $template_name name of email template.
|
674 |
+
* @param string $template_path path to email template.
|
675 |
* @access public
|
676 |
* @return string
|
677 |
*/
|
languages/kadence-woocommerce-email-designer.pot
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
msgid ""
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: Kadence Woocommerce Email Designer\n"
|
5 |
-
"POT-Creation-Date: 2019-12-
|
6 |
"PO-Revision-Date: 2015-05-08 13:15-0700\n"
|
7 |
"Last-Translator: \n"
|
8 |
"Language-Team: \n"
|
@@ -1507,34 +1507,34 @@ msgid ""
|
|
1507 |
"Email Designer</a> plugin by <a href=\"%s\">Kadence Themes</a>."
|
1508 |
msgstr ""
|
1509 |
|
1510 |
-
#: kadence-woocommerce-email-designer.php:
|
1511 |
msgid ""
|
1512 |
"Kadence Woocommerce Email Designer requires WooCommerce to be active to work"
|
1513 |
msgstr ""
|
1514 |
|
1515 |
-
#: kadence-woocommerce-email-designer.php:
|
1516 |
-
#: kadence-woocommerce-email-designer.php:
|
1517 |
msgid "Pay for this order"
|
1518 |
msgstr ""
|
1519 |
|
1520 |
-
#: kadence-woocommerce-email-designer.php:
|
1521 |
-
#: kadence-woocommerce-email-designer.php:
|
1522 |
-
#: kadence-woocommerce-email-designer.php:
|
1523 |
-
#: kadence-woocommerce-email-designer.php:
|
1524 |
msgid "Pay Now »"
|
1525 |
msgstr ""
|
1526 |
|
1527 |
-
#: kadence-woocommerce-email-designer.php:
|
1528 |
-
#: kadence-woocommerce-email-designer.php:
|
1529 |
msgid "Guest"
|
1530 |
msgstr ""
|
1531 |
|
1532 |
-
#: kadence-woocommerce-email-designer.php:
|
1533 |
-
#: kadence-woocommerce-email-designer.php:
|
1534 |
msgid "Email Customizer"
|
1535 |
msgstr ""
|
1536 |
|
1537 |
-
#: kadence-woocommerce-email-designer.php:
|
1538 |
msgid "Open Email Designer"
|
1539 |
msgstr ""
|
1540 |
|
2 |
msgid ""
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: Kadence Woocommerce Email Designer\n"
|
5 |
+
"POT-Creation-Date: 2019-12-19 12:05-0700\n"
|
6 |
"PO-Revision-Date: 2015-05-08 13:15-0700\n"
|
7 |
"Last-Translator: \n"
|
8 |
"Language-Team: \n"
|
1507 |
"Email Designer</a> plugin by <a href=\"%s\">Kadence Themes</a>."
|
1508 |
msgstr ""
|
1509 |
|
1510 |
+
#: kadence-woocommerce-email-designer.php:186
|
1511 |
msgid ""
|
1512 |
"Kadence Woocommerce Email Designer requires WooCommerce to be active to work"
|
1513 |
msgstr ""
|
1514 |
|
1515 |
+
#: kadence-woocommerce-email-designer.php:301
|
1516 |
+
#: kadence-woocommerce-email-designer.php:303
|
1517 |
msgid "Pay for this order"
|
1518 |
msgstr ""
|
1519 |
|
1520 |
+
#: kadence-woocommerce-email-designer.php:314
|
1521 |
+
#: kadence-woocommerce-email-designer.php:316
|
1522 |
+
#: kadence-woocommerce-email-designer.php:323
|
1523 |
+
#: kadence-woocommerce-email-designer.php:325
|
1524 |
msgid "Pay Now »"
|
1525 |
msgstr ""
|
1526 |
|
1527 |
+
#: kadence-woocommerce-email-designer.php:364
|
1528 |
+
#: kadence-woocommerce-email-designer.php:370
|
1529 |
msgid "Guest"
|
1530 |
msgstr ""
|
1531 |
|
1532 |
+
#: kadence-woocommerce-email-designer.php:547
|
1533 |
+
#: kadence-woocommerce-email-designer.php:548
|
1534 |
msgid "Email Customizer"
|
1535 |
msgstr ""
|
1536 |
|
1537 |
+
#: kadence-woocommerce-email-designer.php:562
|
1538 |
msgid "Open Email Designer"
|
1539 |
msgstr ""
|
1540 |
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Tags: woocommerce, mail, email, email template, email templates, email design, p
|
|
4 |
Donate link: https://www.kadencewp.com/about-us/
|
5 |
Requires PHP: 5.2.4
|
6 |
Requires at least: 4.4
|
7 |
-
Tested up to: 5.3.
|
8 |
-
Stable tag: 1.3.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -60,6 +60,10 @@ Install the plugin into the `/wp-content/plugins/` folder, and activate it.
|
|
60 |
|
61 |
== Changelog ==
|
62 |
|
|
|
|
|
|
|
|
|
63 |
= 1.3.7 =
|
64 |
* Update: Fix bug in Gmail mobile app causing footer to not fill the space.
|
65 |
|
4 |
Donate link: https://www.kadencewp.com/about-us/
|
5 |
Requires PHP: 5.2.4
|
6 |
Requires at least: 4.4
|
7 |
+
Tested up to: 5.3.2
|
8 |
+
Stable tag: 1.3.8
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
60 |
|
61 |
== Changelog ==
|
62 |
|
63 |
+
= 1.3.8 =
|
64 |
+
* Update: Fix bug in plan text email.
|
65 |
+
* Update: Add $email default to prevent some fatal errors with plugins using non standard email templates.
|
66 |
+
|
67 |
= 1.3.7 =
|
68 |
* Update: Fix bug in Gmail mobile app causing footer to not fill the space.
|
69 |
|