MS_Model_Communication_After_Finishes

Communication model - after membership finishes.

Defined (1)

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

/app/model/communication/class-ms-model-communication-after-finishes.php  
  1. class MS_Model_Communication_After_Finishes 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_AFTER_FINISHES; 
  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 __( 
  29. 'Sent a predefined number of days after the membership finishes. You must decide how many days after a message is to be sent.', 'membership2' 
  30. ); 
  31.  
  32. /** 
  33. * Communication default communication. 
  34. * @since 1.0.0 
  35. */ 
  36. public function reset_to_default() { 
  37. parent::reset_to_default(); 
  38.  
  39. $this->subject = sprintf( 
  40. __( 'Reminder: your %s membership has ended', 'membership2' ),  
  41. self::COMM_VAR_MS_NAME 
  42. ); 
  43. $this->message = self::get_default_message(); 
  44. $this->enabled = false; 
  45. $this->period_enabled = true; 
  46.  
  47. do_action( 
  48. 'ms_model_communication_reset_to_default_after',  
  49. $this->type,  
  50. $this 
  51. ); 
  52.  
  53. /** 
  54. * Get default email message. 
  55. * @since 1.0.0 
  56. * @return string The email message. 
  57. */ 
  58. public static function get_default_message() { 
  59. $subject = sprintf( 
  60. __( 'Hi %1$s, ', 'membership2' ),  
  61. self::COMM_VAR_USERNAME 
  62. ); 
  63. $body_notice = sprintf( 
  64. __( 'This is a reminder that your %1$s membership at %2$s has ended on %3$s.', 'membership2' ),  
  65. self::COMM_VAR_MS_NAME,  
  66. self::COMM_VAR_BLOG_NAME,  
  67. self::COMM_VAR_MS_EXPIRY_DATE 
  68. ); 
  69. $body_renew = sprintf( 
  70. __( 'You can renew your membership here: %1$s', 'membership2' ),  
  71. self::COMM_VAR_MS_ACCOUNT_PAGE_URL 
  72. ); 
  73.  
  74. $html = sprintf( 
  75. '<h2>%1$s</h2><br /><br />%2$s<br /><br />%3$s',  
  76. $subject,  
  77. $body_notice,  
  78. $body_renew 
  79. ); 
  80.  
  81. return apply_filters( 
  82. 'ms_model_communication_after_finished_get_default_message',  
  83. $html 
  84. );