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
# Find members with active paid memberships but their last order was > 12 months ago. | |
SELECT | |
m.user_id, | |
m.membership_id, | |
u.user_email, | |
MAX(o.timestamp) as last_order_timestamp | |
FROM | |
wp_pmpro_memberships_users m | |
LEFT JOIN wp_users u ON m.user_id = u.ID | |
JOIN |
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 | |
// Check if this class has already been loaded. | |
if ( class_exists( 'Rate_Limiter' ) ) { | |
return; | |
} | |
/** | |
* RateLimiter Class | |
* Limit the number of times a user can perform an action within a given period of time. | |
*/ |
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 these 2 lines to your wp-config.php | |
// This will lock IPs that fail checkout 5 times within 30 minutes. | |
// The default is 10 failures every 15 minutes (900 seconds). | |
define( 'PMPRO_SPAM_ACTION_NUM_LIMIT', 5 ); | |
define( 'PMPRO_SPAM_ACTION_TIME_LIMIT', 1800 ); // in seconds |
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 | |
/** | |
* Update the TOS on the PMPro checkout page to skip the escaping | |
* introduced in PMPro 2.10. This will work in PMPro 2.10.1 or higher. | |
* | |
* You can add this code to your site using the Code Snippets plugin or by | |
* placing the code into a custom plugin or your theme's functions.php. | |
*/ | |
function my_unescaped_pmpro_tos_content( $content, $tospage ) { | |
return do_shortcode( $tospage->post_content ); |
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 | |
/** | |
* Redirect all users to a very specific page on login. | |
* This should work no matter what login form/etc you are using. | |
* If it doesn't work, maybe the 999 priority needs to be higher. | |
* If you want to respect the redirect_to param or earlier callbacks | |
* that overwrite it, uncomment the section at the top of the function. | |
* | |
* You can add this code to your site using the Code Snippets plugin or by | |
* placing the code into a custom plugin or your theme's functions.php. |
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 | |
/** | |
* Swap or translate the password suggestions from the PMPro Strong Password Add On. | |
* These suggestions come from the bundled password strenght library. | |
* Until we update the plugin to make these translatable, | |
* the following code can be used to translate them on your site. | |
* | |
* 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
# 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 | |
/** | |
* Require specific category user meta to view posts in designated categories. | |
* Custom price-adjusting fields are added via user fields. | |
* The initial payment and billing amount is adjusted based on cat selections. | |
* | |
* 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 | |
/* This code will add user_id as a data variable for email templates in PMPro. | |
* | |
* 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/ | |
*/ | |
// begin copying code below here |