Skip to content
Open
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
26 changes: 21 additions & 5 deletions gravity-forms-multi-currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ilanco@gmail.com>
* Author URI: https://github.com/ilanco
*/
Expand All @@ -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__);

Expand All @@ -28,6 +28,8 @@ class GFMultiCurrency

private $currency;

private $gf_mc_debug;

private function __construct()
{
if (!$this->is_gravityforms_supported()) {
Expand Down Expand Up @@ -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<br/>";
echo 'is_active:' . $form_info['is_active'] . '<br/>';
echo '<pre>' . var_export($form_info, true) . '</pre>';
}

// 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'];
}
Expand Down
9 changes: 7 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down