MS_Model_Communication_After_Payment_Due

Communication model - after payment is due.

Defined (1)

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

/app/model/communication/class-ms-model-communication-after-payment-due.php  
  1. class MS_Model_Communication_After_Payment_Due 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_PAYMENT_DUE; 
  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 on due date, 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. 'A payment reminder that is sent a predefined number of days after the payment is due (only if the invoice was not paid until then). 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 = __( 'Membership payment due', 'membership2' ); 
  40. $this->message = self::get_default_message(); 
  41. $this->enabled = false; 
  42. $this->period_enabled = true; 
  43.  
  44. do_action( 'ms_model_communication_reset_to_default_after', $this->type, $this ); 
  45.  
  46. /** 
  47. * Get default email message. 
  48. * @since 1.0.0 
  49. * @return string The email message. 
  50. */ 
  51. public static function get_default_message() { 
  52. $subject = sprintf( 
  53. __( 'Hi %1$s, ', 'membership2' ),  
  54. self::COMM_VAR_USERNAME 
  55. ); 
  56. $body_notice = sprintf( 
  57. __( 'This is a reminder that the payment for your %1$s membership at %2$s is now due (%3$s).', 'membership2' ),  
  58. self::COMM_VAR_MS_NAME,  
  59. self::COMM_VAR_BLOG_NAME,  
  60. self::COMM_VAR_MS_EXPIRY_DATE 
  61. ); 
  62. $body_invoice = __( 'Here are your latest invoice details:', 'membership2' ); 
  63.  
  64. $html = sprintf( 
  65. '<h2>%1$s</h2><br /><br />%2$s<br /><br />%3$s<br /><br />%4$s',  
  66. $subject,  
  67. $body_notice,  
  68. $body_invoice,  
  69. self::COMM_VAR_MS_INVOICE 
  70. ); 
  71.  
  72. return apply_filters( 
  73. 'ms_model_communication_after_payment_due_get_default_message',  
  74. $html 
  75. );