Guest User

Untitled

a guest
Aug 20th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.38 KB | None | 0 0
  1. <?php
  2.  
  3. if ( ! defined( 'ABSPATH' ) ) {
  4. exit; // Exit if accessed directly.
  5. }
  6.  
  7. if ( ! class_exists( 'WC_Email_Customer_New_Account', false ) ) :
  8.  
  9. /**
  10. * Customer New Account.
  11. *
  12. * An email sent to the customer when they create an account.
  13. *
  14. * @class WC_Email_Customer_New_Account
  15. * @version 2.3.0
  16. * @package WooCommerce/Classes/Emails
  17. * @extends WC_Email
  18. */
  19. class WC_Email_Customer_New_Account extends WC_Email {
  20.  
  21. /**
  22. * User login name.
  23. *
  24. * @var string
  25. */
  26. public $user_login;
  27.  
  28. /**
  29. * User email.
  30. *
  31. * @var string
  32. */
  33. public $user_email;
  34.  
  35. /**
  36. * User password.
  37. *
  38. * @var string
  39. */
  40. public $user_pass;
  41.  
  42. /**
  43. * Is the password generated?
  44. *
  45. * @var bool
  46. */
  47. public $password_generated;
  48.  
  49. /**
  50. * Constructor.
  51. */
  52. public function __construct() {
  53. $this->id = 'customer_new_account';
  54. $this->customer_email = true;
  55. $this->title = __( 'New account', 'woocommerce' );
  56. $this->description = __( 'Customer "new account" emails are sent to the customer when a customer signs up via checkout or account pages.', 'woocommerce' );
  57. $this->template_html = 'emails/customer-new-account.php';
  58. $this->template_plain = 'emails/plain/customer-new-account.php';
  59.  
  60. // Call parent constructor.
  61. parent::__construct();
  62. }
  63.  
  64. /**
  65. * Get email subject.
  66. *
  67. * @since 3.1.0
  68. * @return string
  69. */
  70. public function get_default_subject() {
  71. return __( 'Your account on {site_title}', 'woocommerce' );
  72. }
  73.  
  74. /**
  75. * Get email heading.
  76. *
  77. * @since 3.1.0
  78. * @return string
  79. */
  80. public function get_default_heading() {
  81. return __( 'Welcome to {site_title}', 'woocommerce' );
  82. }
  83.  
  84. /**
  85. * Trigger.
  86. *
  87. * @param int $user_id User ID.
  88. * @param string $user_pass User password.
  89. * @param bool $password_generated Whether the password was generated automatically or not.
  90. */
  91. public function trigger( $user_id, $user_pass = '', $password_generated = false ) {
  92. $this->setup_locale();
  93.  
  94. if ( $user_id ) {
  95. $this->object = new WP_User( $user_id );
  96.  
  97. $this->user_pass = $user_pass;
  98. $this->user_login = stripslashes( $this->object->user_login );
  99. $this->user_email = stripslashes( $this->object->user_email );
  100. $this->recipient = $this->user_email;
  101. $this->password_generated = $password_generated;
  102. }
  103.  
  104. if ( $this->is_enabled() && $this->get_recipient() ) {
  105. $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
  106. }
  107.  
  108. $this->restore_locale();
  109. }
  110.  
  111. /**
  112. * Get content html.
  113. *
  114. * @access public
  115. * @return string
  116. */
  117. public function get_content_html() {
  118. //just returns some content of the email, omitted to keep code more concise, if this is relevant I can show function
  119. }
  120.  
  121. /**
  122. * Get content plain.
  123. *
  124. * @access public
  125. * @return string
  126. */
  127. public function get_content_plain() {
  128. //just returns some content of the email, omitted to keep code more concise, if this is relevant I can show function
  129. }
  130. }
  131.  
  132. endif;
  133.  
  134. return new WC_Email_Customer_New_Account();
Add Comment
Please, Sign In to add comment