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 | |
/** | |
* Makes reason for cancelling text field optional. | |
*/ | |
function pmpro_custom_remove_required_cancel() { | |
remove_action( 'init', 'pmpror4c_init' ); | |
} | |
add_action( 'init', 'pmpro_custom_remove_required_cancel', 9 ); |
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 | |
/** | |
* Adds a Register Helper item. | |
* Only allows certain billing fields to be required. | |
* Sets default country selected to Japan | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ |
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 | |
/** | |
* Load a page template for a user page based on level. | |
*/ | |
function pmpro_user_page_redirect_per_level() { | |
// Make sure user is logged in. | |
if ( ! is_user_logged_in() ) { | |
return; | |
} | |
// Make sure we are on a page. |
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 | |
/** | |
* Restrict Membership Signup by Email Domain | |
* Make sure to edit the $valid_domains array defined further below | |
* to include only the domains you'd like to allow. | |
* | |
* Add this code to a custom plugin. More info: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_registration_checks_restrict_email_addresses( $value ) { | |
global $pmpro_level; |
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 | |
/* Enable auto-updates of plugins/themes with cron */ | |
add_action( | |
'wp_update_plugins', | |
function() { | |
if ( wp_doing_cron() && ! doing_action( 'wp_maybe_auto_update' ) ) { | |
do_action( 'wp_maybe_auto_update' ); | |
} | |
}, | |
20 |
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 | |
/* Change from using google.com Recaptcha to recaptcha.net */ | |
add_action( 'init', function() { | |
remove_action( 'wp', 'pmpro_init_recaptcha', 5 ); | |
remove_action( 'init', 'pmpro_init_recaptcha', 20); | |
}, 5 ); | |
function pmpro_init_recaptcha_action_override() { | |
//don't load if setting is off | |
global $recaptcha, $recaptcha_validated; | |
$recaptcha = pmpro_getOption( 'recaptcha' ); |
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 | |
/** | |
* This recipe moves the state field above the phone number during checkout. | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function pmpro_custom_state_field_above_phone_number() { |
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 | |
/** | |
* Redirect non-premium members to landing page. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_temporary_restrict_access() { | |
// Ignore redirecting for non-logged in users. PMPro should take care of non-logged-in access. | |
if ( ! is_user_logged_in() ) { | |
return; | |
} |
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 stats tracking for admins. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function pmpro_remove_admin_tracking_skip() { | |
if ( current_user_can( 'administrator' ) ) { | |
remove_action( 'wp_head', 'pmpro_report_login_wp_views' ); | |
} | |
} |
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 | |
/* Code will add CSS class charity-page to the <body> tag when level and discount code are present in the URL */ | |
add_filter( 'body_class', function( $classes ) { | |
if ( isset( $_REQUEST['level'] ) && isset( $_REQUEST['discount_code'] ) ) { | |
// Additional checks can be done here to ensure the correct level and discount code value. | |
$classes[] = 'charity-page'; | |
} | |
return $classes; | |
} ); |