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 | |
/** | |
* Run this code _once_ and then remove it from your site. To run this code visit any page of the admin area. | |
* After visiting any admin page, you may delete this script from your site. | |
* This will add legacy logic to the content message for non-members. | |
*/ | |
function my_pmpro_legacy_content_message() { | |
// Only logged-in admins can run this. | |
if ( ! current_user_can( 'manage_options' ) || ! empty( get_option( 'pmpro_nonmembertext' ) ) ) { | |
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 | |
/** | |
* Send admin an email notification on Pay By Check pending order creation | |
* | |
* 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
SELECT | |
p.ID as 'Subscription ID', | |
pm1.meta_value as 'User ID', | |
oitems.order_item_name as 'Product', | |
pm2.meta_value as 'Next Payment Date' | |
FROM wp_posts p | |
INNER JOIN wp_postmeta pm1 ON pm1.post_id = p.ID | |
INNER JOIN wp_postmeta pm2 ON pm2.post_id = p.ID | |
INNER JOIN wp_woocommerce_order_items oitems ON oitems.order_id = p.ID | |
WHERE |
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 | |
/** | |
* Support Set Expiration Date Add On for PMPro WooCommerce Add On. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmprowoo_set_expiration_date( $level_array ) { | |
// Make sure Set Expiration Date Add On is active. | |
if ( ! function_exists( 'pmpro_getSetExpirationDate' ) ) { | |
return $level_array; |
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 assumes that Gravatar (or one of it's services is set as the default WP avatar option). | |
* Adjust this code and insert your own URL to the default avatar. | |
* Add this code to your site by following a guide like - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_bua_default_avatar_image( $avatar, $id_or_email ) { | |
if ( strpos( $avatar, 'secure.gravatar.com' ) !== false ) { |
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 recipe will either add a fee or discount to specific variations of a Woo | |
* product based on the level that the user holds. | |
* | |
* In the below example, variation ID 107 should have level 1 and a fee of 1500 will be added. | |
* Variation ID 108 requires a level 2 and applies a discount of 8 | |
* | |
* You can add this recipe to your site by creating a custom plugin |
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 | |
/** | |
* Limit non-admin/editor file uploads to 2mb | |
* We check the upload_files capability, | |
* so anyone with access to the Media Library | |
* can upload files at the PHP/server set max. | |
* | |
* 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 //do not copy | |
/** | |
* This recipe associates a membership level with a Variable product's variation. | |
* You can specify that Variation A should get Level 1 and Variation B should get Level 2. | |
* | |
* Add variations/levels to the array in Line 31 | |
* | |
* Use of this code recipe requires that the PMPro WooCommerce Add On is active. | |
* |
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 code snippet checks if there's more than one item in the cart, | |
* finds the cheapest product and discounts it from the cart's total. | |
*/ | |
function buyone_getone_free_discount() { | |
$contents = edd_get_cart_contents(); |
NewerOlder