Skip to content

Commit

Permalink
Merge pull request #3 from omnisend/use-updated-omnisend-plugin
Browse files Browse the repository at this point in the history
Use updated omnisend plugin
  • Loading branch information
nerijuszaniauskas authored Feb 13, 2024
2 parents 551b27b + 999b5e6 commit 3f567ee
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Plugin Name: Omnisend for Gravity Forms Add-On
* Description: A gravity forms add-on to sync contacts with Omnisend. In collaboration with Omnisnnd for WooCommerce plugin it enables better customer tracking
* Version: 1.1.1
* Version: 1.2.0
* Author: Omnisend
* Author URI: https://www.omnisend.com
* Developer: Omnisend
Expand Down
19 changes: 7 additions & 12 deletions omnisend-for-gravity-forms/class-omnisendaddon.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package OmnisendGravityFormsPlugin
*/

use Omnisend\Public\V1\Contact;
use Omnisend\SDK\V1\Contact;

if ( ! defined( 'ABSPATH' ) ) {
exit;
Expand Down Expand Up @@ -41,13 +41,13 @@ public function omnisend_custom_requirement_callback( $meets_requirements ) {
return $meets_requirements;
}

if ( ! class_exists( 'Omnisend\Public\V1\Omnisend' ) ) {
if ( ! class_exists( 'Omnisend\SDK\V1\Omnisend' ) ) {
$meets_requirements['meets_requirements'] = false;
$meets_requirements['errors'][] = 'Your Email Marketing by Omnisend is not up to date. Please update plugins';
return $meets_requirements;
}

if ( ! Omnisend\Public\V1\Omnisend::is_connected() ) {
if ( ! Omnisend\SDK\V1\Omnisend::is_connected() ) {
$meets_requirements['meets_requirements'] = false;
$meets_requirements['errors'][] = 'Your Email Marketing by Omnisend is not configured properly. Please configure it firstly';
}
Expand Down Expand Up @@ -265,7 +265,7 @@ public function form_settings_fields( $form ) {
* @param array $form The form currently being processed.
*/
public function after_submission( $entry, $form ) {
if ( ! class_exists( 'Omnisend\Public\V1\Omnisend' ) ) {
if ( ! class_exists( 'Omnisend\SDK\V1\Omnisend' ) ) {
return;
}

Expand Down Expand Up @@ -351,14 +351,9 @@ public function after_submission( $entry, $form ) {

$this->mapCustomProperties( $form, $entry, $settings, $contact );

$response = \Omnisend\Public\V1\Omnisend::get_client( OMNISEND_GRAVITY_ADDON_NAME, OMNISEND_GRAVITY_ADDON_VERSION )->create_contact( $contact );
if ( is_wp_error( $response ) ) {
error_log( 'Error in after_submission: ' . $response->get_error_message()); // phpcs:ignore
return;
}

if ( ! is_string( $response ) ) {
error_log( 'Unexpected error. Please contact Omnisend support.'); // phpcs:ignore
$response = \Omnisend\SDK\V1\Omnisend::get_client( OMNISEND_GRAVITY_ADDON_NAME, OMNISEND_GRAVITY_ADDON_VERSION )->create_contact( $contact );
if ( $response->get_wp_error()->has_errors() ) {
error_log( 'Error in after_submission: ' . $response->get_wp_error()->get_error_message()); // phpcs:ignore
return;
}

Expand Down
6 changes: 5 additions & 1 deletion omnisend-for-gravity-forms/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: Gravity forms, form, email marketing, web tracking, subscriber collection
Requires at least: 4.7.0
Tested up to: 6.4
Requires PHP: 7.1
Stable tag: 1.1.1
Stable tag: 1.2.0
License: GPLv3 or later License
URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -61,6 +61,10 @@ Read Omnisend [Terms of Use](https://www.omnisend.com/terms)

== Changelog ==

= 1.2.0 =

* Use Updated Omnisend plugin.

= 1.1.1 =

* Update plugin icon.
Expand Down

0 comments on commit 3f567ee

Please sign in to comment.