MS_Model_Communication_Info_Update

Communication model - info updated.

Defined (1)

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

/app/model/communication/class-ms-model-communication-info-update.php  
  1. class MS_Model_Communication_Info_Update 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_INFO_UPDATE; 
  9.  
  10. /** 
  11. * Add action to update info event. 
  12. * @since 1.0.0 
  13. * @var string The communication type. 
  14. */ 
  15. public function after_load() { 
  16. parent::after_load(); 
  17.  
  18. if ( $this->enabled ) { 
  19. $this->add_action( 
  20. 'ms_model_event_' . MS_Model_Event::TYPE_UPDATED_INFO,  
  21. 'enqueue_messages', 10, 2 
  22. ); 
  23.  
  24. /** 
  25. * Get communication description. 
  26. * @since 1.0.0 
  27. * @return string The description. 
  28. */ 
  29. public function get_description() { 
  30. return __( 
  31. 'Sent when a member updates any personal information (e.g. credit card, name, address details etc.)', MS_TEXT_DOMAIN 
  32. ); 
  33.  
  34. /** 
  35. * Communication default communication. 
  36. * @since 1.0.0 
  37. */ 
  38. public function reset_to_default() { 
  39. parent::reset_to_default(); 
  40.  
  41. $this->subject = __( 'Your billing details have been changed.', MS_TEXT_DOMAIN ); 
  42. $this->message = self::get_default_message(); 
  43. $this->enabled = false; 
  44. $this->save(); 
  45.  
  46. do_action( 
  47. 'ms_model_communication_reset_to_default_after',  
  48. $this->type,  
  49. $this 
  50. ); 
  51.  
  52. /** 
  53. * Get default email message. 
  54. * @since 1.0.0 
  55. * @return string The email message. 
  56. */ 
  57. public static function get_default_message() { 
  58. $subject = sprintf( 
  59. __( 'Hi %1$s, ', MS_TEXT_DOMAIN ),  
  60. self::COMM_VAR_USERNAME 
  61. ); 
  62. $body_notice = __( 'This is to confirm that your billing information has been changed.', MS_TEXT_DOMAIN ); 
  63. $body_account = sprintf( 
  64. __( 'You can review your account details here: %1$s', MS_TEXT_DOMAIN ),  
  65. self::COMM_VAR_MS_ACCOUNT_PAGE_URL 
  66. ); 
  67.  
  68. $html = sprintf( 
  69. '<h2>%1$s</h2><br /><br />%2$s<br /><br />%3$s',  
  70. $subject,  
  71. $body_notice,  
  72. $body_account 
  73. ); 
  74.  
  75. return apply_filters( 
  76. 'ms_model_communication_info_update_get_default_message',  
  77. $html 
  78. );