MC4WP_Registration_Form_Integration

Class MC4WP_Registration_Form_Integration.

Defined (1)

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

/includes/integrations/class-registration-form.php  
  1. class MC4WP_Registration_Form_Integration extends MC4WP_User_Integration { 
  2.  
  3. protected $type = 'registration_form'; 
  4.  
  5. public function __construct() { 
  6.  
  7. parent::__construct(); 
  8.  
  9. add_action( 'register_form', array( $this, 'output_checkbox' ), 20 ); 
  10. add_action( 'user_register', array( $this, 'subscribe_from_registration' ), 90, 1 ); 
  11.  
  12. /** 
  13. * Subscribes from WP Registration Form 
  14. * @param int $user_id 
  15. * @return bool|string 
  16. */ 
  17. public function subscribe_from_registration( $user_id ) { 
  18.  
  19. if( $this->is_spam() ) { 
  20. return false; 
  21.  
  22. // was sign-up checkbox checked? 
  23. if ( $this->checkbox_was_checked() === false ) { 
  24. return false; 
  25.  
  26. // gather emailadress from user who WordPress registered 
  27. $user = get_userdata( $user_id ); 
  28.  
  29. // was a user found with the given ID? 
  30. if ( ! $user ) { 
  31. return false; 
  32.  
  33. $email = $user->user_email; 
  34. $merge_vars = $this->user_merge_vars( $user ); 
  35.  
  36. return $this->subscribe( $email, $merge_vars, 'registration', $user_id ); 
  37. /** End registration form functions */ 
  38.