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 // only copy if needed! | |
/** | |
* Disables repeat purchase for the product | |
* | |
* @param bool $purchasable true if product can be purchased | |
* @param \WC_Product $product the WooCommerce product | |
* @return bool $purchasable the updated is_purchasable check | |
*/ | |
function sv_disable_repeat_purchase( $purchasable, $product ) { |
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
/** | |
* Forward PMPro PayPal IPNs to another domain. | |
* Each domain will process the IPNs. The IPN handlers should be setup to ignore | |
* messages that aren't for that site. PMPro does this. | |
* This is useful if you have 2 different sites using the same PayPal account | |
* and the IPN is setup to go to a PMPro site. | |
* Add this to a custom plugin on the PMPro site the IPN hits. | |
* Update the domain/url to the IPN you want to forward to. | |
* The pmprodev_gateway_debug_setup check makes sure this DOESN'T run if you have the | |
* PMPro Toolkit plugin enabled, i.e. you are on a staging site. |
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
/** | |
* This gist will disable the default behavior in PMPro BuddyPress 5.2.5 or earlier, | |
* which would redirect users away from the BP profile pages if you had | |
* "all of BuddyPress" locked down for non-members or members of a specific level. | |
* | |
* We might address this in future versions of the Add-On, but for now, you can use | |
* this gist. Add it to a Code Snippet or a custom plugin. | |
*/ | |
// First disable the default PMPro BuddyPress behavior. |
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 | |
/** | |
* Password reset on sub site (1 of 4) | |
* Replace login page "Lost Password?" urls. | |
* | |
* @param string $lostpassword_url The URL for retrieving a lost password. | |
* @param string $redirect The path to redirect to. | |
* | |
* @return string | |
* |
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
# oops I had PMPro setup with recurring subscriptions AND expiration dates | |
# I really didn't need the expiration date because the subscription is managed by the gateway | |
# if payment fails, the gateway will try again based on its settings | |
# and when the gateway gives up, it will tell PMPro through IPN/webhook to cancel the subscription | |
# If I have expiration dates setup for recurring subscription, PMPro is going to cancel those subscriptions | |
# whether they pay or not. So I need to edit the level and remove the expiration date AND | |
# run this script to clear out the end dates for active subscriptions. | |
#### | |
# BACK UP YOUR DATABASE FIRST | |
#### |
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 | |
// Exclude pending and denied members from BuddyPress directory. | |
function my_pmpro_bp_bp_pre_user_query_construct( $query_array ) { | |
// Only apply this to the directory. | |
if ( 'members' != bp_current_component() ) { | |
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 | |
// Copy from below here | |
function my_pmproarc_remove_checkbox_with_discount_code() { | |
?> | |
<script> | |
jQuery(document).ready(function() { | |
// After any AJAX call... | |
jQuery( document ).ajaxComplete(function() { |
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 | |
/* | |
Custom Tax Example. | |
- Requires PMPro 1.3.13 or higher. | |
- Leave the tax fields blank in the payment settings. | |
- Level 1 has no tax applied, all other levels have tax applied. | |
- Other levels have 22% tax for IT customers only. | |
- We update the price description to include the tax amount. | |
*/ | |
function my_pmpro_tax( $tax, $values, $order ) { |
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 | |
/** | |
* Creates shipping address fields for 'child' accounts when using the Sponsored/Group Members for Paid Memberships Pro. | |
* This requires the following attribute 'sponsored_accounts_at_checkout' => true for checkout. | |
* PLEASE NOTE: Using the Register Helper Add On (or similar) may interfere with this code if field names match. | |
* | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* Skill Required: Advanced. | |
*/ |
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 | |
/** | |
* This recipe Adds !!company!!/!!phone!! as an available variable for use in Paid Memberships Pro emails. | |
* When the variable is empty it will display nothing instead of the !!company!!/!!phone!! email variable | |
* | |
* Notice the array key does not include the !!s | |
* | |
* 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. |