From acf66448307cabc87f7e4c28617e5f6afd88e0af Mon Sep 17 00:00:00 2001 From: Barry Kooij Date: Tue, 14 Oct 2014 15:18:09 +0200 Subject: [PATCH] Confirm to user email is sent when sending email from within order edit screen. Fixes #6461. --- includes/admin/class-wc-admin-post-types.php | 3 ++- .../class-wc-meta-box-order-actions.php | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/includes/admin/class-wc-admin-post-types.php b/includes/admin/class-wc-admin-post-types.php index 4a7fe4e969a..b158bee1f03 100644 --- a/includes/admin/class-wc-admin-post-types.php +++ b/includes/admin/class-wc-admin-post-types.php @@ -1671,7 +1671,8 @@ class WC_Admin_Post_Types { 8 => __( 'Order submitted.', 'woocommerce' ), 9 => sprintf( __( 'Order scheduled for: %1$s.', 'woocommerce' ), date_i18n( __( 'M j, Y @ G:i', 'woocommerce' ), strtotime( $post->post_date ) ) ), - 10 => __( 'Order draft updated.', 'woocommerce' ) + 10 => __( 'Order draft updated.', 'woocommerce' ), + 11 => __( 'Order updated and email sent.', 'woocommerce' ) ); $messages['shop_coupon'] = array( diff --git a/includes/admin/meta-boxes/class-wc-meta-box-order-actions.php b/includes/admin/meta-boxes/class-wc-meta-box-order-actions.php index daff2e3007f..36def66f594 100644 --- a/includes/admin/meta-boxes/class-wc-meta-box-order-actions.php +++ b/includes/admin/meta-boxes/class-wc-meta-box-order-actions.php @@ -125,6 +125,9 @@ class WC_Meta_Box_Order_Actions { do_action( 'woocommerce_after_resend_order_email', $order, $email_to_send ); + // Change the post saved message + add_filter( 'redirect_post_location', array( __CLASS__, 'set_email_sent_message' ) ); + } elseif ( $action == 'regenerate_download_permissions' ) { delete_post_meta( $post_id, '_download_permissions_granted' ); @@ -137,4 +140,21 @@ class WC_Meta_Box_Order_Actions { } } } + + /** + * Set the correct message ID + * + * @param $location + * + * @since 2.3.0 + * @access public + * + * @static + * + * @return string + */ + public static function set_email_sent_message($location) { + return add_query_arg( 'message', 11, $location ); + } + }