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 | |
/** | |
* Allow non-members to view restricted posts if they are less than 30 days old. | |
* Change the '-30 Days' below if you'd like to allow access for longer or shorter. | |
* Adjust $categories array for the categories this should apply to. | |
* Add this code to your Customizations Plugin by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function open_new_posts_to_non_members($hasaccess, $thepost, $theuser, $post_membership_levels) { | |
global $wpdb; |
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 | |
/** | |
* Bulk Update all member's with level ID 4 to be locked indefinitely. | |
* Run this code by adding to your site, loading a page. Once done, you may remove this code from your site. | |
*/ | |
function bulk_lock_all_members() { | |
if ( ! current_user_can( 'manage_options' ) ) { | |
return; |
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 | |
/** | |
* Edit the Signup Shortcode password that is generated and emailed to the customer. | |
* Add this code to your site by following this guide: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
remove_filter('pmpro_email_data', 'pmprosus_pmpro_email_data', 10, 2); | |
function pmprosus_pmpro_email_data_edit($data, $email) { | |
if ( function_exists( 'pmpro_start_session' ) ) { |
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 | |
/* | |
Redirect to login or homepage if user is logged out or not a member | |
Add this code to your active theme's functions.php file. | |
*/ | |
function my_template_redirect() | |
{ | |
global $current_user; | |
$okay_pages = array(pmpro_getOption('billing_page_id'), pmpro_getOption('account_page_id'), pmpro_getOption('levels_page_id'), pmpro_getOption('checkout_page_id'), pmpro_getOption('confirmation_page_id')); |
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 | |
/** | |
* Allow other business email addresses for PMPro IPN Messages. | |
* To add this code to your site you may follow this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_ipn_check_receiver_email($check, $email) { | |
if ( in_array( '[email protected]', $email ) ) { //change email here to the old email | |
$check = true; | |
} |
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 | |
/** | |
* This recipe changes the MAXFAILEDPAYMENTS limit for PayPal | |
* | |
* 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 mypmpro_max_failed_payments_adjust( $nvpStr, $order ){ |
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 | |
/** | |
* This recipe Adds !!company!!/!!phone!! as an available variable for use in Paid Memberships Pro emails. | |
* When the variable is empty it will display nothing instead of the !!company!!/!!phone!! email variable | |
* | |
* Notice the array key does not include the !!s | |
* | |
* 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. |
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 | |
/** | |
* Creates shipping address fields for 'child' accounts when using the Sponsored/Group Members for Paid Memberships Pro. | |
* This requires the following attribute 'sponsored_accounts_at_checkout' => true for checkout. | |
* PLEASE NOTE: Using the Register Helper Add On (or similar) may interfere with this code if field names match. | |
* | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* Skill Required: Advanced. | |
*/ |
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 | |
/* | |
Custom Tax Example. | |
- Requires PMPro 1.3.13 or higher. | |
- Leave the tax fields blank in the payment settings. | |
- Level 1 has no tax applied, all other levels have tax applied. | |
- Other levels have 22% tax for IT customers only. | |
- We update the price description to include the tax amount. | |
*/ | |
function my_pmpro_tax( $tax, $values, $order ) { |
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 | |
// Copy from below here | |
function my_pmproarc_remove_checkbox_with_discount_code() { | |
?> | |
<script> | |
jQuery(document).ready(function() { | |
// After any AJAX call... | |
jQuery( document ).ajaxComplete(function() { |