Created
February 18, 2016 15:44
-
-
Save greathmaster/960287af84c19ddd4217 to your computer and use it in GitHub Desktop.
Provide a discount for members who are expired
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
function custom_renewal($level) | |
{ | |
global $wpdb, $current_user; | |
$levelshistory = $wpdb->get_results("SELECT * FROM $wpdb->pmpro_memberships_users WHERE user_id = '$current_user->ID' ORDER BY id DESC"); | |
if($levelshistory && $levelshistory[0]->status == 'expired' && $levelshistory[0]->membership_id == $level->id) | |
{ | |
$level->initial_payment = ($level->initial_payment/2); | |
} | |
return $level; | |
} | |
add_filter("pmpro_checkout_level", "custom_renewal"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This recipe is included in the blog post on "Offer Expired and “Old” Members a Membership Renewal Discount for Coming Back" at Paid Memberships Pro here: https://www.paidmembershipspro.com/offer-expired-old-members-membership-renewal-discount-coming-back/