From 0f36cc69f26502c6dc2b39cc2db2fd0f4886c73a Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Tue, 11 Dec 2012 17:05:31 +0000 Subject: [PATCH] Only use server if set. Closes #1970. --- classes/class-wc-order.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/classes/class-wc-order.php b/classes/class-wc-order.php index ed022696cd3..346aeb82909 100644 --- a/classes/class-wc-order.php +++ b/classes/class-wc-order.php @@ -1135,9 +1135,13 @@ class WC_Order { $is_customer_note = intval( $is_customer_note ); + if ( isset( $_SERVER['HTTP_HOST'] ) ) + $comment_author_email = sanitize_email( strtolower( __( 'WooCommerce', 'woocommerce' ) ) . '@' . str_replace( 'www.', '', $_SERVER['HTTP_HOST'] ) ); + else + $comment_author_email = sanitize_email( strtolower( __( 'WooCommerce', 'woocommerce' ) ) . '@noreply.com'; + $comment_post_ID = $this->id; $comment_author = __( 'WooCommerce', 'woocommerce' ); - $comment_author_email = sanitize_email( strtolower( __( 'WooCommerce', 'woocommerce' ) ) . '@' . str_replace( 'www.', '', $_SERVER['HTTP_HOST'] ) ); $comment_author_url = ''; $comment_content = $note; $comment_agent = 'WooCommerce';