new account emails

This commit is contained in:
Mike Jolley 2011-11-08 13:47:49 +00:00
parent 5af84b5246
commit 4bd2f287f0
4 changed files with 52 additions and 1 deletions

View File

@ -549,7 +549,8 @@ class woocommerce_checkout {
wp_update_user( array ('ID' => $user_id, 'role' => 'customer') ) ;
// send the user a confirmation and their login details
wp_new_user_notification( $user_id, $user_pass );
woocommerce_customer_new_account( $user_id, $user_pass );
//wp_new_user_notification( $user_id, $user_pass );
// set the WP login cookie
$secure_cookie = is_ssl() ? true : false;

View File

@ -100,6 +100,7 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo
* Improved order search
* Option to unforce SSL checkout
* Support for X-Accel-Redirect / X-Sendfile for downloads
* Customer new account email when signing up from the checkout
= 1.2 - 03/11/2011 =
* Added quick status change buttons (processing/complete) to orders panel

View File

@ -0,0 +1,16 @@
<?php global $user_login, $user_pass, $blogname; ?>
<?php do_action('woocommerce_email_header'); ?>
<p><?php echo sprintf(__("Thanks for registering on %s. Your login details are below:", 'woothemes'), $blogname); ?></p>
<ul>
<li><?php echo sprintf(__('Username: %s'), $user_login); ?></li>
<li><?php echo sprintf(__('Password: %s'), $user_pass); ?></li>
</ul>
<p><?php echo sprintf(__("You can login to your account area here: %s.", 'woothemes'), get_permalink(get_option('woocommerce_myaccount_page_id'))); ?></p>
<div style="clear:both;"></div>
<?php do_action('woocommerce_email_footer'); ?>

View File

@ -306,3 +306,36 @@ function woocommerce_email_order_meta( $order, $sent_to_admin ) {
endforeach;
endif;
}
/**
* Customer new account welcome email
**/
function woocommerce_customer_new_account( $user_id, $plaintext_pass ) {
global $email_heading, $user_login, $user_pass, $blogname;
if ( empty($plaintext_pass) ) return;
$user = new WP_User($user_id);
$user_login = stripslashes($user->user_login);
$user_email = stripslashes($user->user_email);
$user_pass = $plaintext_pass;
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
$subject = sprintf(__('Your account on %s', 'woothemes'), $blogname);
$email_heading = __('Your account details', 'woothemes');
// Buffer
ob_start();
// Get mail template
woocommerce_get_template('emails/customer_new_account.php', false);
// Get contents
$message = ob_get_clean();
// Send the mail
woocommerce_mail( $user_email, $subject, $message );
}