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 | |
function my_pmprorh_init() { | |
// Don't break if Register Helper is not loaded. | |
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) { | |
return false; | |
} | |
// Define the fields. | |
$fields = array(); | |
$fields[] = new PMProRH_Field( |
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 | |
/** | |
* Show pages/posts a level/user has access to. | |
* | |
* @param array $atts Shortcode attributes. | |
* | |
* @return string HTML for the post list. | |
*/ | |
function member_content_list( $atts ) { | |
if ( ! is_user_logged_in() ) { |
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 | |
function pmpro_custom_banned_domains( $continue_registration ) { | |
global $pmpro_msg, $pmpro_msgt; | |
if ( isset ( $_REQUEST['bemail'] ) ) { | |
$bemail = sanitize_email( stripslashes( $_REQUEST['bemail'] ) ); | |
$banned_email_domains = array( | |
'.ru', /* Add more email domains here */ | |
); | |
foreach ( $banned_email_domains as $domain ) { | |
if ( strstr( $bemail, $domain ) ) { |
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 | |
function pmpro_multisite_subsite_custom_redirect() { | |
if ( is_main_site() || is_admin() ) { | |
return; | |
} | |
if ( function_exists( 'pmpro_hasMembershipLevel' ) ) { | |
global $current_user; | |
if ( 0 == $current_user->ID || ! pmpro_hasMembershipLevel() ) { | |
wp_redirect( get_site_url( 1, '/membership-account/membership-levels/' ) ); // Assume main site ID is 1. | |
exit; |
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 the BGN currency to currency list. | |
function pmpro_currencies_bulgarian( $currencies ) { | |
$currencies['BGN'] = __( 'Bulgarian', 'pmpro' ); | |
return $currencies; | |
} | |
add_filter( 'pmpro_currencies', 'pmpro_currencies_bulgarian' ); |
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; | |
} ); |
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 | |
/** | |
* 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 | |
/** | |
* 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 | |
/* 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' ); |