MS_Model_Communication_Renewed

Communication model - subscription was renewed.

Defined (1)

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

/app/model/communication/class-ms-model-communication-renewed.php  
  1. class MS_Model_Communication_Renewed extends MS_Model_Communication { 
  2.  
  3. /** 
  4. * Add action to credit card expire event. 
  5. * Related Action Hooks: 
  6. * - ms_model_event_paid 
  7. * @since 1.0.0 
  8. * @var string The communication type. 
  9. */ 
  10. protected $type = self::COMM_TYPE_RENEWED; 
  11.  
  12. /** 
  13. * Get communication description. 
  14. * @since 1.0.0 
  15. * @return string The description. 
  16. */ 
  17. public function get_description() { 
  18. return __( 
  19. 'Sent to the member when a previously expired or cancelled membership is renewed - triggered for both free and paid memberships.', 'membership2' 
  20. ); 
  21.  
  22. /** 
  23. * Communication default communication. 
  24. * @since 1.0.0 
  25. */ 
  26. public function reset_to_default() { 
  27. parent::reset_to_default(); 
  28.  
  29. $this->subject = sprintf( 
  30. __( 'Subscription renewed for %s', 'membership2' ),  
  31. self::COMM_VAR_BLOG_NAME 
  32. ); 
  33. $this->message = self::get_default_message(); 
  34. $this->enabled = false; 
  35.  
  36. do_action( 
  37. 'ms_model_communication_reset_to_default_after',  
  38. $this->type,  
  39. $this 
  40. ); 
  41.  
  42. /** 
  43. * Get default email message. 
  44. * @since 1.0.0 
  45. * @return string The email message. 
  46. */ 
  47. public static function get_default_message() { 
  48. $subject = sprintf( 
  49. __( 'Hi %1$s, ', 'membership2' ),  
  50. self::COMM_VAR_USERNAME 
  51. ); 
  52. $body_notice = sprintf( 
  53. __( 'Thanks for renewing your <strong>%1$s</strong> subscription over at %2$s!', 'membership2' ),  
  54. self::COMM_VAR_MS_NAME,  
  55. self::COMM_VAR_BLOG_NAME 
  56. ); 
  57. $body_account = sprintf( 
  58. __( 'You can review and edit your membership details here: %1$s', 'membership2' ),  
  59. self::COMM_VAR_MS_ACCOUNT_PAGE_URL 
  60. ); 
  61.  
  62. $html = sprintf( 
  63. '<h2>%1$s</h2><br /><br />%2$s<br /><br />%3$s<br />',  
  64. $subject,  
  65. $body_notice,  
  66. $body_account 
  67. ); 
  68.  
  69. return apply_filters( 
  70. 'ms_model_communication_renewed_get_default_message',  
  71. $html 
  72. ); 
  73.  
  74. /** 
  75. * Process communication registration. 
  76. * @since 1.0.0 
  77. */ 
  78. public function process_communication( $event, $subscription ) { 
  79. do_action( 
  80. 'ms_model_communication_renewed_process_before',  
  81. $subscription,  
  82. $event,  
  83. $this 
  84. ); 
  85.  
  86. $this->send_message( $subscription ); 
  87.  
  88. do_action( 
  89. 'ms_model_communication_renewed_process_after',  
  90. $subscription,  
  91. $event,  
  92. $this 
  93. );