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 default text for the one-membership-product-per-cart warning in PMPro WooCommerce. | |
* Add this code to a custom plugin. https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_gettext_pmprowc_changes( $translated_text, $text, $domain ) { | |
if( $domain == "pmpro-woocommerce" && $text == "You may only add one membership to your %scart%s." ) { | |
$translated_text = "Include the %stwo percent-s strings%s, which will add the start and end a tags."; | |
} | |
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
/** | |
* Add a BTC currency to Paid Memberships Pro | |
* Add this code into a custom plugin. https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function pmpro_btc_currency_format( $pmpro_currencies ) { | |
$pmpro_currencies['BTC'] = array( | |
'name' => __( 'Bitcoin', 'paid-memberships-pro' ), | |
'decimals' => '8', | |
'thousands_separator' => '', | |
'decimal_separator' => '.', |
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
/** | |
* We need to set $_REQUEST['level'] early on our | |
* sitewide sales pages to support other customizations. | |
* We can't use is_page because WP isn't fully setup yet. | |
* Update the $sitewide_sales_pages and $default_level_id as needed. | |
* Add to a custom plugin. | |
*/ | |
function set_request_level_on_sitewide_sales_pages() { | |
$sitewide_sales_pages = array( | |
'blackfriday', |
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
/** | |
* Hide the PMPro pricing box at checkout | |
* and replace with our own. | |
* | |
* Require PMPro v1.9.5.6+ and PMPro Sitewide Sales v1.0+ | |
* Add this into a custom plugin. | |
*/ | |
function override_pricing_fields_on_sitewide_sales_pages( $include_pricing_fields ) { | |
global $wpdb, $pmpro_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
/** | |
* Check for merged plugins that should be deactivated. | |
*/ | |
function pmpro_check_for_deprecated_plugins() { | |
$pmpro_deprecated_plugins = array( | |
'pmpro-better-logins-report/pmpro-better-logins-report.php' => 'Better Logins Report', | |
); | |
$plugins_to_deactivate = array(); | |
foreach( $pmpro_deprecated_plugins as $plugin_path => $plugin_name ) { |
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 | |
/* | |
Plugin Name: Paid Memberships Pro - Custom Register Helper Fields | |
Plugin URI: https://www.paidmembershipspro.com/documentation/register-helper-documentation/code-examples/ | |
Description: Register Helper Fields | |
Version: .1 | |
Author: Stranger Studios | |
Author URI: http://www.strangerstudios.com | |
*/ | |
//we have to put everything in a function called on init, so we are sure Register Helper is loaded |
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
/** | |
* Keep pmpro_next_payment_date() from using the Stripe API. | |
* Instead, the next payment date will be calculated based on | |
* the date of the last order in PMPro. | |
* This will be inaccurate in some cases with regards to trials, | |
* but avoids issues where Stripe is giving the wrong "next payment" | |
* date when payments fail. | |
*/ | |
function my_disable_stripe_api_next_payment_date( $next_payment_date ) { | |
// remove this filter which may run later |
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
/** | |
* Testing the pmprosed_fixDate function. | |
* 1. Make sure PMPro and PMPro Set Expiration Dates is active. | |
* 2. Add this code to a custom plugin. | |
* 3. Visit ?test_date_functions=1 to a URL | |
* 4. Remember to remove the code when done. | |
*/ | |
function test_set_expiration_dates() { | |
if( empty( $_REQUEST['test_date_functions'] ) ) { | |
return; |
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 | |
/** | |
* Add this function into a customizations plugin | |
* and then visit /?test_braintree_webhook from a browser. | |
*/ | |
function init_test_braintree_webhook() { | |
if(!empty($_REQUEST['test_braintree_webhook'])) { | |
define('PMPRO_BRAINTREE_WEBHOOK_DEBUG', true); | |
$gateway = new PMProGateway_braintree(); |
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
# Avoid errors in MySQL 5.7 | |
UPDATE wp_pmpro_memberships_users SET enddate = NULL WHERE CAST(enddate AS CHAR(20)) = '0000-00-00 00:00:00'; | |
# Fix membership_levels table | |
ALTER TABLE `wp_pmpro_membership_levels` MODIFY `initial_payment` decimal(18,8); | |
ALTER TABLE `wp_pmpro_membership_levels` MODIFY `billing_amount` decimal(18,8); | |
ALTER TABLE `wp_pmpro_membership_levels` MODIFY `trial_amount` decimal(18,8); | |
# Fix memberships_users table | |
ALTER TABLE `wp_pmpro_memberships_users` MODIFY `initial_payment` decimal(18,8); |