MS_Model_Communication_Signup

Communication model - user sign up.

Defined (1)

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

/app/model/communication/class-ms-model-communication-signup.php  
  1. class MS_Model_Communication_Signup extends MS_Model_Communication { 
  2.  
  3. /** 
  4. * Communication type. 
  5. * @since 1.0.0 
  6. * @var string The communication type. 
  7. */ 
  8. protected $type = self::COMM_TYPE_SIGNUP; 
  9.  
  10. /** 
  11. * Get communication description. 
  12. * @since 1.0.0 
  13. * @return string The description. 
  14. */ 
  15. public function get_description() { 
  16. return __( 
  17. 'Welcome email sent to a user who created a new WordPress account.', 'membership2' 
  18. ); 
  19.  
  20. /** 
  21. * Communication default communication. 
  22. * @since 1.0.0 
  23. */ 
  24. public function reset_to_default() { 
  25. parent::reset_to_default(); 
  26.  
  27. $this->subject = sprintf( 
  28. __( 'Welcome to %s!', 'membership2' ),  
  29. self::COMM_VAR_BLOG_NAME 
  30. ); 
  31. $this->message = self::get_default_message(); 
  32. $this->enabled = false; 
  33.  
  34. do_action( 
  35. 'ms_model_communication_reset_to_default_after',  
  36. $this->type,  
  37. $this 
  38. ); 
  39.  
  40. /** 
  41. * Get default email message. 
  42. * @since 1.0.0 
  43. * @return string The email message. 
  44. */ 
  45. public static function get_default_message() { 
  46. $subject = sprintf( 
  47. __( 'Hi %1$s, ', 'membership2' ),  
  48. self::COMM_VAR_USERNAME 
  49. ); 
  50. $body_notice = sprintf( 
  51. __( 'welcome to %s! We have created a brand new account for you and you can head right over to %s and log in with your username and password.', 'membership2' ),  
  52. self::COMM_VAR_BLOG_NAME,  
  53. self::COMM_VAR_BLOG_URL 
  54. ); 
  55. $body_account = sprintf( 
  56. __( 'Username: %s<br>Password: %s', 'membership2' ),  
  57. self::COMM_VAR_USERNAME,  
  58. self::COMM_VAR_PASSWORD 
  59. ); 
  60.  
  61. $html = sprintf( 
  62. '<h2>%1$s</h2><br /><br />%2$s<br /><br />%3$s',  
  63. $subject,  
  64. $body_notice,  
  65. $body_account 
  66. ); 
  67.  
  68. return apply_filters( 
  69. 'ms_model_communication_signup_get_default_message',  
  70. $html 
  71. ); 
  72.  
  73. /** 
  74. * Process communication registration. 
  75. * @since 1.0.0 
  76. */ 
  77. public function process_communication( $event, $subscription ) { 
  78. do_action( 
  79. 'ms_model_communication_signup_process_before',  
  80. $subscription,  
  81. $event,  
  82. $this 
  83. ); 
  84.  
  85. $this->send_message( $subscription ); 
  86.  
  87. do_action( 
  88. 'ms_model_communication_signup_process_after',  
  89. $subscription,  
  90. $event,  
  91. $this 
  92. );