Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
make GF Stripe add-on ignore credit card fields so that they can operate normally for other add-ons
<?php
/*
Plugin Name: GF Stripe Ignore CC Fields
Plugin URI: https://gist.github.com/webaware/0488a4bed8d16627af4de52092a356a6
Description: make GF Stripe add-on ignore credit card fields so that they can operate normally for other add-ons
Version: 1
Author: WebAware
Author URI: https://shop.webaware.com.au/
*/
/*
copyright (c) 2021 WebAware Pty Ltd (email : support@webaware.com.au)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
namespace webawareau\gf_stripe_ignore_cc;
use GFStripe;
if (!defined('ABSPATH')) {
exit;
}
/**
* add our init hook to run after GF Stripe has initialised its hooks
*/
add_action('gform_loaded', function () {
add_action('init', __NAMESPACE__ . '\\remove_stripe_inputs', 20);
});
/**
* remove GF Stripe's add-on hook for fiddling around with credit card fields
*/
function remove_stripe_inputs() {
if (class_exists('GFStripe')) {
$gfstripe = GFStripe::get_instance();
remove_filter('gform_field_content', [$gfstripe, 'add_stripe_inputs'], 10, 5);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment