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 | |
/** | |
* Make sure that PMPro loads the Stripe library first if other plugins are loading outdated | |
* versions on every page load. This is a blunt way to address the conflict and should be used | |
* with caution. | |
* | |
* To use, add as a new file in your site's `wp-content/mu-plugins/` folder. | |
*/ | |
if ( file_exists( dirname( __FILE__ ) . "/../plugins/paid-memberships-pro/includes/lib/Stripe/init.php" ) && ! class_exists( "Stripe\Stripe" ) ) { |
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 | |
/** | |
* Clear any unnecessary Stripe data from level meta table that may be causing checkout issues. | |
* | |
* To run this code add it to your WordPress website by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* Once installed, add ?clean_stripe=1 to any URL while logged-in as an admin. | |
* | |
* After running this script, please delete it from your site. | |
* | |
* @return void |
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 // do not copy this line. | |
/** | |
* Give user's with a certain level ID 4 free access to all some Addon Packages content. | |
* | |
* 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 | |
/** | |
* Integrate Addon Packages with WooCommerce product purchased (based on the order status). | |
* Recommended to be used with PMPro WooCommerce to apply a default level for all products that give access to posts (Addon Packages). | |
* | |
* To get started, please adjust the $product_ids_to_posts global array which uses a product_id => post_id key/value pair. | |
* Extend this array for all products that will give access to posts. | |
* | |
* Adds access to the post once the order is completed. | |
* Removes access from the post if the order is set to cancelled, failed or refunded. |
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 //do not copy | |
/** | |
* This recipe will automatically populate the PMPro checkout fields Woocommerce field data. | |
* | |
* 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 gist updates the "cancel all memberships" link on the cancel page | |
* to pass the level ids into the page instead of "all". | |
* This will ensure that all the levels are cancelled one by one. | |
* In addition to sending a separate email for each cancellation, | |
* this also ensures the $old_level parameter is sent to the | |
* pmpro_cancelMembershipLevel() function so Add Ons like the | |
* Cancel on Next Payment Date one continue to work. | |
* |
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 //do not copy | |
/** | |
* This recipe lock members into their existing membership. | |
* They won't be able to cancel or sign up for a different membership level. | |
* | |
* Change lines 19 and 43 to the level ID that requires you to be locked in. | |
* | |
* If you don't want to prevent them from cancelling, comment out line 30 with // | |
* | |
* You can add this recipe to your site by creating a custom plugin |
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 | |
/** | |
* Prorate initial payments (only) for Paid Memberships Pro checkouts. | |
* This will prorate for any active members changing levels. If the level is the same price, it does not prorate to $0. | |
* If a member is 'downgrading' levels, set the price to $0. (i.e. $10 -> $5 level will set the initial payment to $0). | |
* | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function pmpro_prorate_levels_price( $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 | |
/** | |
* Returns membership information when scanning QR Code on Membership Card Add On. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_qr_code_example( $member, $option ){ | |
if ( $option == 'other' ){ |
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 text "Welcome, %s" to "Hello %s" for Paid Memberships Pro | |
* | |
* 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/ | |
*/ |