MC4WP_Unsubscribe_Request

The MailChimp for WordPress Lite MC4WP Unsubscribe Request class.

Defined (1)

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

/includes/class-unsubscribe-request.php  
  1. class MC4WP_Unsubscribe_Request extends MC4WP_Request { 
  2. /** 
  3. * @return bool 
  4. */ 
  5. public function process() { 
  6.  
  7. $api = mc4wp_get_api(); 
  8. $result = false; 
  9.  
  10. foreach( $this->get_lists() as $list_id ) { 
  11. $result = $api->unsubscribe( $list_id, $this->user_data['EMAIL'] ); 
  12.  
  13. if( ! $result ) { 
  14. $this->mailchimp_error = $api->get_error_message(); 
  15. $this->message_type = ( in_array( $api->get_error_code(), array( 215, 232 ) ) ) ? 'not_subscribed' : 'error'; 
  16. } else { 
  17. $this->message_type = 'unsubscribed'; 
  18.  
  19. $this->success = $result; 
  20.  
  21. return $result; 
  22.  
  23. /** 
  24. */ 
  25. public function prepare() { 
  26. return true;