MS_Model_Communication_Cancelled

Communication model - membership cancelled.

Defined (1)

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

/app/model/communication/class-ms-model-communication-cancelled.php  
  1. class MS_Model_Communication_Cancelled 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_CANCELLED; 
  9.  
  10. /** 
  11. * Populates the field title/description of the Period before/after field 
  12. * in the admin settings. 
  13. * @since 1.0.0 
  14. * @param array $field A HTML definition, passed to lib3()->html->element() 
  15. */ 
  16. public function set_period_name( $field ) { 
  17. $field['title'] = __( 'Message Delay', 'membership2' ); 
  18. $field['desc'] = __( 'Use "0" to send instantly, or another value to delay the message.', 'membership2' ); 
  19.  
  20. return $field; 
  21.  
  22. /** 
  23. * Get communication description. 
  24. * @since 1.0.0 
  25. * @return string The description. 
  26. */ 
  27. public function get_description() { 
  28. return __( 'Sent when membership is cancelled.', 'membership2' ); 
  29.  
  30. /** 
  31. * Communication default communication. 
  32. * @since 1.0.0 
  33. */ 
  34. public function reset_to_default() { 
  35. parent::reset_to_default(); 
  36.  
  37. $this->subject = sprintf( 
  38. __( 'Your %s membership was canceled', 'membership2' ),  
  39. self::COMM_VAR_MS_NAME 
  40. ); 
  41. $this->message = self::get_default_message(); 
  42. $this->enabled = false; 
  43. $this->period_enabled = true; 
  44.  
  45. do_action( 
  46. 'ms_model_communication_reset_to_default_after',  
  47. $this->type,  
  48. $this 
  49. ); 
  50.  
  51. /** 
  52. * Get default email message. 
  53. * @since 1.0.0 
  54. * @return string The email message. 
  55. */ 
  56. public static function get_default_message() { 
  57. $subject = sprintf( 
  58. __( 'Hi %1$s, ', 'membership2' ),  
  59. self::COMM_VAR_USERNAME 
  60. ); 
  61. $body_notice = sprintf( 
  62. __( 'Your %1$s membership at %2$s was successfully cancelled.', 'membership2' ),  
  63. self::COMM_VAR_MS_NAME,  
  64. self::COMM_VAR_BLOG_NAME 
  65. ); 
  66. $body_register = sprintf( 
  67. __( 'Should you change your mind, you can renew your membership here: %1$s', 'membership2' ),  
  68. self::COMM_VAR_MS_ACCOUNT_PAGE_URL 
  69. ); 
  70. $body_payments = __( 'Here are your latest payment details:', 'membership2' ); 
  71.  
  72. $html = sprintf( 
  73. '<h2>%1$s</h2><br /><br />%2$s<br /><br />%3$s<br /><br />%4$s<br /><br />%5$s',  
  74. $subject,  
  75. $body_notice,  
  76. $body_register,  
  77. $body_payments,  
  78. self::COMM_VAR_MS_INVOICE 
  79. ); 
  80.  
  81. return apply_filters( 
  82. 'ms_model_communication_cancelled_get_default_message',  
  83. $html 
  84. );