1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) exit;
4
5 if ( ! class_exists( 'WC_Email_Customer_New_Account' ) ) :
6
7 8 9 10 11 12 13 14 15 16 17
18 class WC_Email_Customer_New_Account extends WC_Email {
19
20 var $user_login;
21 var $user_email;
22 var $user_pass;
23
24 25 26 27 28 29
30 function __construct() {
31
32 $this->id = 'customer_new_account';
33 $this->title = __( 'New account', 'woocommerce' );
34 $this->description = __( 'Customer new account emails are sent when a customer signs up via the checkout or My Account page.', 'woocommerce' );
35
36 $this->template_html = 'emails/customer-new-account.php';
37 $this->template_plain = 'emails/plain/customer-new-account.php';
38
39 $this->subject = __( 'Your account on {site_title}', 'woocommerce');
40 $this->heading = __( 'Welcome to {site_title}', 'woocommerce');
41
42
43 parent::__construct();
44 }
45
46 47 48 49 50 51
52 function trigger( $user_id, $user_pass = '', $password_generated = false ) {
53
54 if ( $user_id ) {
55 $this->object = new WP_User( $user_id );
56
57 $this->user_pass = $user_pass;
58 $this->user_login = stripslashes( $this->object->user_login );
59 $this->user_email = stripslashes( $this->object->user_email );
60 $this->recipient = $this->user_email;
61 $this->password_generated = $password_generated;
62 }
63
64 if ( ! $this->is_enabled() || ! $this->get_recipient() )
65 return;
66
67 $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
68 }
69
70 71 72 73 74 75
76 function get_content_html() {
77 ob_start();
78 wc_get_template( $this->template_html, array(
79 'email_heading' => $this->get_heading(),
80 'user_login' => $this->user_login,
81 'user_pass' => $this->user_pass,
82 'blogname' => $this->get_blogname(),
83 'password_generated' => $this->password_generated,
84 'sent_to_admin' => false,
85 'plain_text' => false
86 ) );
87 return ob_get_clean();
88 }
89
90 91 92 93 94 95
96 function get_content_plain() {
97 ob_start();
98 wc_get_template( $this->template_plain, array(
99 'email_heading' => $this->get_heading(),
100 'user_login' => $this->user_login,
101 'user_pass' => $this->user_pass,
102 'blogname' => $this->get_blogname(),
103 'password_generated' => $this->password_generated,
104 'sent_to_admin' => false,
105 'plain_text' => true
106 ) );
107 return ob_get_clean();
108 }
109 }
110
111 endif;
112
113 return new WC_Email_Customer_New_Account();