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 | |
// Copy from below here... | |
/* | |
* Overwrite the modified email confirmation message from PMPro Email Confirmation Add On. | |
*/ | |
function my_pmproec_pmpro_confirmation_message( $message ) { | |
remove_filter( 'pmpro_confirmation_message', 'pmproec_pmpro_confirmation_message' ); | |
//must be an email confirmation 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 | |
/** | |
* Restrict categories on the sub-site of a MS network. | |
* Install as an mu-plugin (advanced users only) | |
*/ | |
function my_pmpro_member_pmpro_has_membership_access_filter( $access, $post, $user, $levels ) { | |
// If main site, leave alone. | |
if ( is_main_site() || is_admin() ) { | |
return $access; |
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 the 2Checkout hosted checkout default language for Paid Memberships Pro WordPress Plugin. | |
* Please see https://www.2checkout.com/documentation/checkout/parameter-sets/pass-through-products/ (Additional Parameters) for available languages. | |
* | |
* 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 | |
/** | |
* This code recipe requires an Addon Package to be purchased for a particular level. Please adjust the level ID on line 18. | |
* | |
* 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 my_pmpro_require_ap_for_checkout( $continue ) { |
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
/** | |
* Bulk update all users to have an expiration date that belong to a specific membership level. | |
* This code should be run directly inside your WordPress database. | |
* Please update the wp_ prefix to match that of your database as well as the membership_id and enddate value (YYYY-MM-DD). | |
* | |
* IMPORTANT: Have a backup of your site before running this code. | |
*/ | |
UPDATE wp_pmpro_memberships_users SET enddate = '2020-12-31 00:00:00' WHERE status = 'active' AND membership_id = 1; |
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 | |
/** | |
* Gets the start date for a user and outputs it to the account page membership table. | |
* | |
* 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 my_pmpro_add_extra_column_members_table() { |
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
/** | |
* Please have a backup of your database before running this code. | |
* Adjust your 'wp_' prefix to match that of your WordPress database. | |
* This works only with mySQL databases. | |
* | |
* Adjust the expiration date by 10 years for all discount codes starting with "S". | |
*/ | |
UPDATE wp_pmpro_discount_codes SET `expires` = DATE_ADD(expires, INTERVAL 10 YEAR) WHERE `code` LIKE 'S%' |
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 an email variable !!tax!! to Paid Memberships Pro emails. | |
* Only works for email templates that has the !!invoice_id!! variable available. | |
* Use the Email Templates Admin Editor to add !!tax!! to your email templates. | |
* Follow this guide to add this code to your site: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* | |
* Difficulty: Easy | |
*/ | |
function my_pmpro_email_variable( $data, $email ) { |
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 | |
/** | |
* 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 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 | |
/** | |
* Hide content for logged-out and user's without levels when using [membership level="-20"] shortcode. | |
* This will only hide content if negative levels are used. Default functionality remains if using "10,-20" in the level's attribute. | |
* Follow this guide to add this code to your site - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_custom_shortcode_check( $hasaccess, $content, $levels, $delay ) { | |
// Check if array contains only negative numbers. | |
$negative = false; |