MS_Model_Communication_Finished

Communication model - membership finished.

Defined (1)

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

/app/model/communication/class-ms-model-communication-finished.php  
  1. class MS_Model_Communication_Finished 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_FINISHED; 
  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. 'Sent as soon as the membership is deactivated.', '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. __( 'Your %s membership has ended', 'membership2' ),  
  29. self::COMM_VAR_MS_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. __( 'Your %1$s membership at %2$s has ended on %3$s.', 'membership2' ),  
  52. self::COMM_VAR_MS_NAME,  
  53. self::COMM_VAR_BLOG_NAME,  
  54. self::COMM_VAR_MS_EXPIRY_DATE 
  55. ); 
  56. $body_renew = sprintf( 
  57. __( 'You can renew your membership here: %1$s', 'membership2' ),  
  58. self::COMM_VAR_MS_ACCOUNT_PAGE_URL 
  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_renew 
  66. ); 
  67.  
  68. return apply_filters( 
  69. 'ms_model_communication_finished_get_default_message',  
  70. $html 
  71. );