Forked from ideadude/my_require_cvv_for_reals.php
Last active
February 15, 2019 13:25
-
-
Save andrewlimaza/1510ac5795edab55c5a21c978e3b3716 to your computer and use it in GitHub Desktop.
Set CVV as a Required Field with PMPro
This file contains 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 | |
/** | |
* Set CVV as a Required Field with PMPro | |
* Add this code to a custom plugin. https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* | |
* NOTE: Doesn't yet work with Stripe, Braintree, or PayPal Express (most gateways) that don't pass the CVV to the server. | |
*/ | |
function my_require_cvv_for_reals( $fields ) { | |
if ( ! empty( $_REQUEST['CVV'] ) ) { | |
$CVV = sanitize_text_field( $_REQUEST['CVV'] ); | |
} elseif ( ! empty( $_REQUEST['StripeToken0'] ) ) { | |
$CVV = true; | |
} else { | |
$CVV = ''; | |
} | |
$fields['CVV'] = $CVV; | |
return $fields; | |
} | |
add_filter( 'pmpro_required_billing_fields', 'my_require_cvv_for_reals', 15 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment