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 | |
/** | |
* 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(); |
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 | |
/** | |
* Gets the next payment date and marks that as the expiration date for users. | |
* | |
* The "next payment" value is an estimate based on the billing cycle of the subscription and the last order date. It may be off from the actual recurring date set at the gateway, especially if the subscription was updated at the gateway. | |
* | |
* Remove the // on line 40 to run the update query. | |
* | |
* 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
# PMPro doesn't set the character set when creating its tables. | |
# So on install PMPro will use the default character set for your DB. | |
# In some cases this might be something like latin1, which will not | |
# work with special characters for non-latin languages, e.g. Hebrew. | |
# To fix this, you can update the character set on these tables using MySQL. | |
# | |
# IMPORTANT: Back up your DB (at least these tables) before running any queries. | |
ALTER TABLE wp_pmpro_membership_levels CONVERT TO CHARACTER SET utf8; | |
ALTER TABLE wp_pmpro_membership_levelmeta CONVERT TO CHARACTER SET utf8; | |
ALTER TABLE wp_pmpro_membership_ordermeta CONVERT TO CHARACTER SET utf8; |
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 will add billing fields to the administrative user profile edit page for administrators | |
* and on the frontend PMPro user Edit Profile page for members. | |
* | |
* 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/ | |
*/ |
NewerOlder