Created
June 8, 2017 21:42
-
-
Save eighty20results/6edb5df42f9c7b57839141c9850c4868 to your computer and use it in GitHub Desktop.
Customizations to use the "Capture Name & Address for Free Levels or for Offsite Gateway" add-on
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: PMPro Customizations: Required Field Changes | |
Plugin URI: https://eighty20results.com/paid-memberships-pro/do-it-for-me/ | |
Description: Customizations to disable required fields for some of the Address/Addon. | |
Version: 1.0 | |
Author: Eighty / 20 Results by Wicked Strong Chicks, LLC <[email protected]> | |
Author URI: https://eighty20results.com/thomas-sjolshagen/ | |
License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html | |
License: GPLv2 or later | |
*/ | |
/* | |
* Copyright (c) 2017 - Eighty / 20 Results by Wicked Strong Chicks. | |
* ALL RIGHTS RESERVED | |
* | |
* 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 3 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, see <http://www.gnu.org/licenses/>. | |
*/ | |
function ic_hide_paypal_link() { | |
global $show_paypal_link; | |
if ( true === $show_paypal_link ) { | |
$show_paypal_link = false; | |
add_filter( 'pmpro_include_billing_address_fields', '__return_true', 30 ); | |
add_filter( 'pmpro_include_payment_information_fields', '__return_false', 30 ); | |
} | |
} | |
add_filter( 'pmpro_billing_preheader', 'ic_hide_paypal_link' ); | |
function ic_required_field_filter( $fields ) { | |
unset( $fields["baddress1"] ); | |
unset( $fields["bcity"] ); | |
unset( $fields["bstate"] ); | |
unset( $fields["bzipcode"] ); | |
unset( $fields["bcountry"] ); | |
return $fields; | |
} | |
add_filter( 'pmpro_required_billing_fields', 'ic_required_field_filter', 40 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment