Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
'MC4WP_Ninja_Forms_Field' => '/integrations/ninja-forms/class-field.php',
'MC4WP_Ninja_Forms_Integration' => '/integrations/ninja-forms/class-ninja-forms.php',
'MC4WP_Ninja_Forms_V2_Integration' => '/integrations/ninja-forms-2/class-ninja-forms.php',
'MC4WP_PeepSo_Integration' => '/integrations/peepso/class-peepso.php',
'MC4WP_Plugin' => '/includes/class-plugin.php',
'MC4WP_Procaptcha_Integration' => '/integrations/prosopo-procaptcha/class-procaptcha-integration.php',
'MC4WP_Procaptcha' => '/integrations/prosopo-procaptcha/class-procaptcha.php',
Expand Down
1 change: 1 addition & 0 deletions integrations/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function mc4wp_admin_after_integration_settings(MC4WP_Integration $integration,
mc4wp_register_integration('contact-form-7', 'MC4WP_Contact_Form_7_Integration', true);
mc4wp_register_integration('events-manager', 'MC4WP_Events_Manager_Integration');
mc4wp_register_integration('memberpress', 'MC4WP_MemberPress_Integration');
mc4wp_register_integration('peepso', 'MC4WP_PeepSo_Integration');
mc4wp_register_integration('affiliatewp', 'MC4WP_AffiliateWP_Integration');
mc4wp_register_integration('give', 'MC4WP_Give_Integration');
mc4wp_register_integration('custom', 'MC4WP_Custom_Integration', true);
Expand Down
65 changes: 65 additions & 0 deletions integrations/peepso/class-peepso.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

defined('ABSPATH') or exit;

/**
* Class MC4WP_PeepSo_Integration
*
* @ignore
*/
class MC4WP_PeepSo_Integration extends MC4WP_User_Integration
{
/**
* @var string
*/
public $name = 'PeepSo';

/**
* @var string
*/
public $description = 'Subscribes users from PeepSo registration forms.';

/**
* Add hooks
*/
public function add_hooks()
{
if (! $this->options['implicit']) {
add_action('peepso_register_extended_fields', [ $this, 'output_checkbox' ], 20);
}

add_action('peepso_register_new_user', [ $this, 'subscribe_from_peepso' ], 10, 1);
}

/**
* Subscribes from PeepSo Registration Form.
*
* @param int $user_id
* @return bool
*/
public function subscribe_from_peepso($user_id)
{
if (! $this->triggered()) {
return false;
}

$user = get_userdata($user_id);

// was a user found with the given ID?
if (! $user instanceof WP_User) {
return false;
}

$data = $this->user_merge_vars($user);

return $this->subscribe($data, $user_id);
}

/**
* @return bool
*/
public function is_installed()
{
return class_exists('PeepSo');
}
}