Created
September 21, 2017 15:46
-
-
Save andrewlimaza/bb1006f1df86f5a0285e9735ce592501 to your computer and use it in GitHub Desktop.
Remove first and last name for certain levels for
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 | |
| /** | |
| * Remove fields from certain levels for the Add Name To Checkout - https://www.paidmembershipspro.com/add-ons/add-first-last-name-to-checkout/ | |
| * Add this to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function remove_name_from_fields() { | |
| $levels_to_remove_fields_from = array( '1', '2', '3', '4', '5' ); //change the level ID's in this to hide the fields from this. | |
| if( ! empty( $_REQUEST['level'] ) ) { | |
| if( in_array( $_REQUEST['level'], $levels_to_remove_fields_from ) ){ | |
| remove_action('pmpro_checkout_after_password', 'pmproan2c_pmpro_checkout_after_password'); | |
| remove_filter("pmpro_registration_checks", "pmproan2c_pmpro_registration_checks"); | |
| remove_action('pmpro_after_checkout', 'pmproan2c_update_first_and_last_name_after_checkout'); | |
| remove_action("pmpro_paypalexpress_session_vars", "pmproan2c_pmpro_paypalexpress_session_vars"); | |
| } | |
| } | |
| } | |
| add_action( 'init', 'remove_name_from_fields' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment