MC4WP_BuddyPress_Integration

Class MC4WP_BuddyPress_Integration.

Defined (1)

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

/includes/integrations/class-buddypress.php  
  1. class MC4WP_BuddyPress_Integration extends MC4WP_User_Integration { 
  2.  
  3. protected $type = 'buddypress_form'; 
  4.  
  5. public function __construct() { 
  6.  
  7. parent::__construct(); 
  8.  
  9. add_action( 'bp_before_registration_submit_buttons', array( $this, 'output_checkbox' ), 20 ); 
  10. add_action( 'bp_core_signup_user', array( $this, 'subscribe_from_buddypress' ), 10, 4 ); 
  11.  
  12. /** 
  13. * Subscribes from BuddyPress Registration Form 
  14. * @param int $user_id 
  15. * @param string $user_login 
  16. * @param string $user_password 
  17. * @param string $user_email 
  18. * @param array $usermeta 
  19. */ 
  20. public function subscribe_from_buddypress( $user_id, $user_login, $user_password, $user_email ) { 
  21.  
  22. if( $this->is_spam() ) { 
  23. return false; 
  24.  
  25. if ( $this->checkbox_was_checked() === false ) { 
  26. return false; 
  27.  
  28. $user = get_userdata( $user_id ); 
  29.  
  30. // was a user found with the given ID? 
  31. if ( ! $user ) { 
  32. return false; 
  33.  
  34. // gather emailadress and name from user who BuddyPress registered 
  35. $email = $user->user_email; 
  36. $merge_vars = $this->user_merge_vars( $user ); 
  37.  
  38. return $this->subscribe( $email, $merge_vars, 'buddypress_registration', $user_id ); 
  39. /** End BuddyPress functions */ 
  40.