WC_Email_Customer_New_Account

Customer New Account.

Defined (1)

The class is defined in the following location(s).

/includes/emails/class-wc-email-customer-new-account.php  
  1. class WC_Email_Customer_New_Account extends WC_Email { 
  2.  
  3. /** 
  4. * User login name. 
  5. * @var string 
  6. */ 
  7. public $user_login; 
  8.  
  9. /** 
  10. * User email. 
  11. * @var string 
  12. */ 
  13. public $user_email; 
  14.  
  15. /** 
  16. * User password. 
  17. * @var string 
  18. */ 
  19. public $user_pass; 
  20.  
  21. /** 
  22. * Is the password generated? 
  23. * @var bool 
  24. */ 
  25. public $password_generated; 
  26.  
  27. /** 
  28. * Constructor. 
  29. */ 
  30. public function __construct() { 
  31.  
  32. $this->id = 'customer_new_account'; 
  33. $this->customer_email = true; 
  34. $this->title = __( 'New account', 'woocommerce' ); 
  35. $this->description = __( 'Customer "new account" emails are sent to the customer when a customer signs up via checkout or account pages.', 'woocommerce' ); 
  36.  
  37. $this->template_html = 'emails/customer-new-account.php'; 
  38. $this->template_plain = 'emails/plain/customer-new-account.php'; 
  39.  
  40. $this->subject = __( 'Your account on {site_title}', 'woocommerce' ); 
  41. $this->heading = __( 'Welcome to {site_title}', 'woocommerce' ); 
  42.  
  43. // Call parent constructor 
  44. parent::__construct(); 
  45.  
  46. /** 
  47. * Trigger. 
  48. * @param int $user_id 
  49. * @param string $user_pass 
  50. * @param bool $password_generated 
  51. */ 
  52. public 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. if ( ! $this->is_enabled() || ! $this->get_recipient() ) { 
  64. return; 
  65.  
  66. $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() ); 
  67.  
  68. /** 
  69. * Get content html. 
  70. * @access public 
  71. * @return string 
  72. */ 
  73. public function get_content_html() { 
  74. return wc_get_template_html( $this->template_html, array( 
  75. 'email_heading' => $this->get_heading(),  
  76. 'user_login' => $this->user_login,  
  77. 'user_pass' => $this->user_pass,  
  78. 'blogname' => $this->get_blogname(),  
  79. 'password_generated' => $this->password_generated,  
  80. 'sent_to_admin' => false,  
  81. 'plain_text' => false,  
  82. 'email' => $this,  
  83. ) ); 
  84.  
  85. /** 
  86. * Get content plain. 
  87. * @access public 
  88. * @return string 
  89. */ 
  90. public function get_content_plain() { 
  91. return wc_get_template_html( $this->template_plain, array( 
  92. 'email_heading' => $this->get_heading(),  
  93. 'user_login' => $this->user_login,  
  94. 'user_pass' => $this->user_pass,  
  95. 'blogname' => $this->get_blogname(),  
  96. 'password_generated' => $this->password_generated,  
  97. 'sent_to_admin' => false,  
  98. 'plain_text' => true,  
  99. 'email' => $this,  
  100. ) );