Skip to content

Commit

Permalink
Merge pull request #9 from vidmantaskiro/fix-consent-behavior
Browse files Browse the repository at this point in the history
Fixing incorrect behavior for consent
  • Loading branch information
greta-mik authored Oct 23, 2024
2 parents 9b889c2 + ce09726 commit a93c981
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Plugin Name: Omnisend for Paid Memberships Pro Add-On
* Description: A Paid Memberships Pro add-on to sync contacts with Omnisend. In collaboration with Paid Memberships Pro plugin it enables better customer tracking
* Version: 1.0.3
* Version: 1.0.4
* Author: Omnisend
* Author URI: https://www.omnisend.com
* Developer: Omnisend
Expand All @@ -26,7 +26,7 @@
}

define( 'OMNISEND_MEMBERSHIPS_ADDON_NAME', 'Omnisend for Paid Memberships Pro Add-On' );
define( 'OMNISEND_MEMBERSHIPS_ADDON_VERSION', '1.0.3' );
define( 'OMNISEND_MEMBERSHIPS_ADDON_VERSION', '1.0.4' );

spl_autoload_register( array( 'Omnisend_PaidMembershipsProAddOn', 'autoloader' ) );
add_action( 'plugins_loaded', array( 'Omnisend_PaidMembershipsProAddOn', 'check_plugin_requirements' ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function create_contact( array $mapped_fields ): Contact {

$current_user = wp_get_current_user();
$user_email = $current_user->user_email;
$options = get_option( 'omnisend_pmp_options' );

if ( 0 != $current_user->ID ) {
$user_email = $mapped_fields['bemail'];
Expand All @@ -51,7 +52,7 @@ public function create_contact( array $mapped_fields ): Contact {
$contact->set_city( $mapped_fields['bcity'] ?? '' );
$contact->set_welcome_email( true );

if ( ! isset( $options['setting_field'] ) ) {
if ( isset( $options['setting_field'] ) ) {
if ( isset( $mapped_fields['bconsentEmail'] ) ) {
$contact->set_email_subscriber();
$contact->set_email_consent( self::CONSENT_PREFIX );
Expand Down Expand Up @@ -120,6 +121,7 @@ public function create_contact_from_user_info( array $user_info ): Contact {
*/
public function update_profile_contact( array $mapped_fields, string $phone_number = null ): Contact {
$contact = new Contact();
$options = get_option( 'omnisend_pmp_options' );

$contact->set_email( $mapped_fields['user_email'] );
if ( isset( $phone_number ) ) {
Expand All @@ -128,7 +130,7 @@ public function update_profile_contact( array $mapped_fields, string $phone_numb
$contact->set_first_name( $mapped_fields['first_name'] ?? '' );
$contact->set_last_name( $mapped_fields['last_name'] ?? '' );

if ( ! isset( $options['setting_field'] ) ) {
if ( isset( $options['setting_field'] ) ) {
if ( isset( $mapped_fields['bconsentEmail'] ) ) {
$contact->set_email_subscriber();
$contact->set_email_consent( self::CONSENT_PREFIX );
Expand Down
2 changes: 1 addition & 1 deletion omnisend-for-paid-memberships-pro/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: Paid Memberships Pro, form, email marketing, web tracking, subscriber coll
Requires at least: 4.7.0
Tested up to: 6.6
Requires PHP: 7.4
Stable tag: 1.0.3
Stable tag: 1.0.4
License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Expand Down

0 comments on commit a93c981

Please sign in to comment.