From 482d7e9291b0516bb2a65defbf180763452b4579 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Tue, 1 Nov 2011 17:11:57 +0000 Subject: [PATCH] Option for new order/stock recipient. Closes #124. --- admin/admin-settings.php | 24 ++++++++++++++++++++++-- readme.txt | 1 + woocommerce_emails.php | 8 ++++---- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/admin/admin-settings.php b/admin/admin-settings.php index 1a301234e25..ee022405eb5 100644 --- a/admin/admin-settings.php +++ b/admin/admin-settings.php @@ -644,8 +644,28 @@ $woocommerce_settings['tax'] = apply_filters('woocommerce_tax_settings', array( )); // End tax settings $woocommerce_settings['email'] = apply_filters('woocommerce_email_settings', array( - - array( 'name' => __( 'Email Options', 'woothemes' ), 'type' => 'title', '', 'id' => 'email_options' ), + + array( 'name' => __( 'Email Recipient Options', 'woothemes' ), 'type' => 'title', '', 'id' => 'email_recipient_options' ), + + array( + 'name' => __( 'New order notifications', 'woothemes' ), + 'desc' => __( 'The recipient of new order emails. Defaults to the admin email.', 'woothemes' ), + 'id' => 'woocommerce_new_order_email_recipient', + 'type' => 'text', + 'std' => esc_attr(get_option('admin_email')) + ), + + array( + 'name' => __( 'Inventory notifications', 'woothemes' ), + 'desc' => __( 'The recipient of stock emails. Defaults to the admin email.', 'woothemes' ), + 'id' => 'woocommerce_stock_email_recipient', + 'type' => 'text', + 'std' => esc_attr(get_option('admin_email')) + ), + + array( 'type' => 'sectionend', 'id' => 'email_recipient_options' ), + + array( 'name' => __( 'Email Sender Options', 'woothemes' ), 'type' => 'title', '', 'id' => 'email_options' ), array( 'name' => __( '"From" name', 'woothemes' ), diff --git a/readme.txt b/readme.txt index 7f749f445bf..1b13be98da8 100644 --- a/readme.txt +++ b/readme.txt @@ -94,6 +94,7 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo * Custom field for product total_sales when sold * Best sellers widget based on new total_sales field * Ability to exclude product ids +* Option for the recipient of order/stock emails * Edit category - image fix * Order Complete email heading fix * 100% discount when price excludes tax logic fix diff --git a/woocommerce_emails.php b/woocommerce_emails.php index 268e299a233..c7732a32889 100644 --- a/woocommerce_emails.php +++ b/woocommerce_emails.php @@ -110,7 +110,7 @@ function woocommerce_new_order_notification( $id ) { $message = ob_get_clean(); // Send the mail - woocommerce_mail( get_option('admin_email'), $subject, $message ); + woocommerce_mail( get_option('woocommerce_new_order_email_recipient'), $subject, $message ); } @@ -222,7 +222,7 @@ function woocommerce_low_stock_notification( $product ) { $subject = '[' . get_bloginfo('name') . '] ' . __('Product low in stock', 'woothemes'); $message = '#' . $_product->id .' '. $_product->get_title() . ' ('. $_product->sku.') ' . __('is low in stock.', 'woothemes'); $message = wordwrap( html_entity_decode( strip_tags( $message ) ), 70 ); - wp_mail( get_option('admin_email'), $subject, $message ); + wp_mail( get_option('woocommerce_stock_email_recipient'), $subject, $message ); } @@ -234,7 +234,7 @@ function woocommerce_no_stock_notification( $product ) { $subject = '[' . get_bloginfo('name') . '] ' . __('Product out of stock', 'woothemes'); $message = '#' . $_product->id .' '. $_product->get_title() . ' ('. $_product->sku.') ' . __('is out of stock.', 'woothemes'); $message = wordwrap( html_entity_decode( strip_tags( $message ) ), 70 ); - wp_mail( get_option('admin_email'), $subject, $message ); + wp_mail( get_option('woocommerce_stock_email_recipient'), $subject, $message ); } @@ -246,7 +246,7 @@ function woocommerce_product_on_backorder_notification( $product, $amount ) { $subject = '[' . get_bloginfo('name') . '] ' . __('Product Backorder', 'woothemes'); $message = $amount . __(' units of #', 'woothemes') . $_product->id .' '. $_product->get_title() . ' ('. $_product->sku.') ' . __('have been backordered.', 'woothemes'); $message = wordwrap( html_entity_decode( strip_tags( $message ) ), 70 ); - wp_mail( get_option('admin_email'), $subject, $message ); + wp_mail( get_option('woocommerce_stock_email_recipient'), $subject, $message ); } /**