WC_Email_Customer_Reset_Password

Customer Reset Password.

Defined (1)

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

/includes/emails/class-wc-email-customer-reset-password.php  
  1. class WC_Email_Customer_Reset_Password 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. * Reset key. 
  17. * @var string 
  18. */ 
  19. public $reset_key; 
  20.  
  21. /** 
  22. * Constructor. 
  23. */ 
  24. public function __construct() { 
  25.  
  26. $this->id = 'customer_reset_password'; 
  27. $this->title = __( 'Reset password', 'woocommerce' ); 
  28. $this->description = __( 'Customer "reset password" emails are sent when customers reset their passwords.', 'woocommerce' ); 
  29. $this->customer_email = true; 
  30.  
  31. $this->template_html = 'emails/customer-reset-password.php'; 
  32. $this->template_plain = 'emails/plain/customer-reset-password.php'; 
  33.  
  34. $this->subject = __( 'Password reset for {site_title}', 'woocommerce' ); 
  35. $this->heading = __( 'Password reset instructions', 'woocommerce' ); 
  36.  
  37. // Trigger 
  38. add_action( 'woocommerce_reset_password_notification', array( $this, 'trigger' ), 10, 2 ); 
  39.  
  40. // Call parent constructor 
  41. parent::__construct(); 
  42.  
  43. /** 
  44. * Trigger. 
  45. * @param string $user_login 
  46. * @param string $reset_key 
  47. */ 
  48. public function trigger( $user_login = '', $reset_key = '' ) { 
  49. if ( $user_login && $reset_key ) { 
  50. $this->object = get_user_by( 'login', $user_login ); 
  51.  
  52. $this->user_login = $user_login; 
  53. $this->reset_key = $reset_key; 
  54. $this->user_email = stripslashes( $this->object->user_email ); 
  55. $this->recipient = $this->user_email; 
  56.  
  57. if ( ! $this->is_enabled() || ! $this->get_recipient() ) { 
  58. return; 
  59.  
  60. $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() ); 
  61.  
  62.  
  63. /** 
  64. * Get content html. 
  65. * @access public 
  66. * @return string 
  67. */ 
  68. public function get_content_html() { 
  69. return wc_get_template_html( $this->template_html, array( 
  70. 'email_heading' => $this->get_heading(),  
  71. 'user_login' => $this->user_login,  
  72. 'reset_key' => $this->reset_key,  
  73. 'blogname' => $this->get_blogname(),  
  74. 'sent_to_admin' => false,  
  75. 'plain_text' => false,  
  76. 'email' => $this,  
  77. ) ); 
  78.  
  79. /** 
  80. * Get content plain. 
  81. * @access public 
  82. * @return string 
  83. */ 
  84. public function get_content_plain() { 
  85. return wc_get_template_html( $this->template_plain, array( 
  86. 'email_heading' => $this->get_heading(),  
  87. 'user_login' => $this->user_login,  
  88. 'reset_key' => $this->reset_key,  
  89. 'blogname' => $this->get_blogname(),  
  90. 'sent_to_admin' => false,  
  91. 'plain_text' => true,  
  92. 'email' => $this,  
  93. ) );