diff --git a/composer.json b/composer.json index 27a5b03..8569265 100644 --- a/composer.json +++ b/composer.json @@ -2,5 +2,5 @@ "name" : "ilanco/gravity-forms-multi-currency", "description" : "Gravity Forms Multi Currency", "type" : "wordpress-plugin", - "version" : "1.7.1" + "version" : "1.7.2" } diff --git a/gravity-forms-multi-currency.php b/gravity-forms-multi-currency.php index 2b3e657..abd9c1a 100644 --- a/gravity-forms-multi-currency.php +++ b/gravity-forms-multi-currency.php @@ -3,7 +3,7 @@ * Plugin Name: Gravity Forms Multi Currency * Plugin URI: https://github.com/ilanco/gravity-forms-multi-currency * Description: Per form currency for Gravity Forms. - * Version: 1.7.1 + * Version: 1.7.2 * Author: Ilan Cohen * Author URI: https://github.com/ilanco */ @@ -16,7 +16,7 @@ if (!defined('ABSPATH')) die(false); -define('GF_MC_VERSION', '1.7.1'); +define('GF_MC_VERSION', '1.7.2'); define('GF_MC_MAINFILE', __FILE__); @@ -28,6 +28,8 @@ class GFMultiCurrency private $currency; + private $gf_mc_debug; + private function __construct() { if (!$this->is_gravityforms_supported()) { @@ -61,13 +63,27 @@ public static function init() public function form_process() { + // asp: setup way to dump the form_info; probably a better way to do this + $gf_mc_debug = 0; + $form_id = isset($_POST["gform_submit"]) ? $_POST["gform_submit"] : 0; + if ($form_id) { - $form_info = RGFormsModel::get_form($form_id); - $is_valid_form = $form_info && $form_info->is_active; + // asp: use new GFAPI class returns an array + $form_info = GFAPI::get_form( $form_id ); + + if ( $gf_mc_debug ) { + echo "form_id: $form_id
"; + echo 'is_active:' . $form_info['is_active'] . '
'; + echo '
' . var_export($form_info, true) . '
'; + } + + // asp: since the result is an array check for + // asp: is_active using array notation + $is_valid_form = $form_info && $form_info['is_active']; if ($is_valid_form) { - $form = RGFormsModel::get_form_meta($form_id); + $form = GFAPI::get_form( $form_id ); if (isset($form['currency']) && $form['currency']) { $this->currency = $form['currency']; } diff --git a/readme.txt b/readme.txt index ebe949b..dde9b0f 100644 --- a/readme.txt +++ b/readme.txt @@ -3,8 +3,9 @@ Contributors: ilanco Donate link: https://www.gittip.com/ilanco/ Tags: gravity, forms, gravity forms, gravity form, currency, multiple Requires at least: 3.0.1 -Tested up to: 3.8.1 -Stable tag: 1.7.1 +Tested Wordpress Version to: 4.7 +Tested Gravity Forms Version to: 2.1.2 +Stable tag: 1.7.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -29,6 +30,10 @@ the value to the desired currency for this form. == Changelog == += 1.7.2 = + +Update calls to reference GFAPI instead of RGFormsModel (as it's deprecated). + = 1.7.1 = Fixed setting currency after upgrade to Gravity Forms 1.7.3