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 | |
/** | |
* Remove subscription delay for existing/past members. | |
*/ | |
function my_pmpro_remove_subscription_delay_for_renewals() { | |
if ( is_admin() || ! is_user_logged_in() ) { | |
return; | |
} | |
$order = new MemberOrder(); |
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 | |
/** | |
* Grant access to the back-end to certain user roles | |
* | |
* @param bool $prevent_admin_access | |
* | |
* @return bool | |
*/ | |
function pmpro_grant_admin_access_to_dataanalyst( $prevent_admin_access ) { | |
if ( current_user_can( 'dataanalyst' ) ) { |
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 // do not copy this line. | |
/** | |
* Sponsored Members setup with child seat costs at checkout. | |
* SPONSOR SEAT + 4 seats 19.95 each | |
* + 5 to 19 @ 17.95 | |
* + 20 to 39 @ $15.95 | |
* + 40 to 79 @ 14.95 | |
* | |
* 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. |
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 | |
/** | |
* Readonly field on profile edit page. | |
* | |
* Add profile_readonly to field and set to true. | |
* | |
* Fields with this option will remain editable if the field is empty, or | |
* if the current user can manage options (administrators), or | |
* if the current user is a membership manager that have a | |
* membership manager role. |
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 | |
/** | |
* WordPress Mail Debugger | |
* | |
* Log mail error message to debug-mail.log in wp-contents folder. | |
* Log mail error to debug.log in wp-contents folder. | |
*/ | |
function wp_mail_error_log( $wp_error ) { | |
// Log mail error message to debug-mail.log file in wp-contents folder |
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 | |
/** | |
* Add HTML5 attribute required to all required PMPro fields. | |
* | |
* 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 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 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 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 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. |