| Server IP : 34.67.85.211 / Your IP : 216.73.217.52 Web Server : Apache System : Linux wordpress-1-vm 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64 User : root ( 0) PHP Version : 7.4.9 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /var/www/html/wp-content/plugins/mailchimp-for-wp/integrations/memberpress/ |
Upload File : |
<?php
defined( 'ABSPATH' ) or exit;
/**
* Class MC4WP_MemberPress_Integration
*
* @ignore
*/
class MC4WP_MemberPress_Integration extends MC4WP_Integration {
/**
* @var string
*/
public $name = 'MemberPress';
/**
* @var string
*/
public $description = 'Subscribes people from MemberPress register forms.';
/**
* Add hooks
*/
public function add_hooks() {
if ( ! $this->options['implicit'] ) {
if ( has_action( 'mepr_checkout_before_submit' ) ) {
add_action( 'mepr_checkout_before_submit', array( $this, 'output_checkbox' ) );
} else {
add_action( 'mepr-checkout-before-submit', array( $this, 'output_checkbox' ) );
}
}
if ( has_action( 'mepr_signup' ) ) {
add_action( 'mepr_signup', array( $this, 'subscribe_from_memberpress' ), 5 );
} else {
add_action( 'mepr-signup', array( $this, 'subscribe_from_memberpress' ), 5 );
}
}
/**
* Subscribe from MemberPress sign-up forms.
*
* @param MeprTransaction $txn
* @return bool
*/
public function subscribe_from_memberpress( $txn ) {
// Is this integration triggered? (checkbox checked or implicit)
if ( ! $this->triggered() ) {
return false;
}
$user = get_userdata( $txn->user_id );
$data = array(
'EMAIL' => $user->user_email,
'FNAME' => $user->first_name,
'LNAME' => $user->last_name,
);
// subscribe using email and name
return $this->subscribe( $data, $txn->id );
}
/**
* @return bool
*/
public function is_installed() {
return defined( 'MEPR_VERSION' );
}
}