Last active
February 19, 2019 23:24
-
-
Save andrewlimaza/fc51691daab073d0ed63 to your computer and use it in GitHub Desktop.
Recurring Donation for PMPRO
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
This function is used with Paidmemberships Pro Donations addon. | |
This adds the functionality of making the users donation added to their recurring billing amount. |
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
//set price | |
function pmprodon_pmpro_donation_recurring($level) | |
{ | |
if(isset($_REQUEST['donation'])) | |
$donation = preg_replace("[^0-9\.]", "", $_REQUEST['donation']); | |
else | |
return $level; | |
if(!empty($donation)) | |
{ | |
//save initial payment amount | |
global $pmprodon_original_initial_payment; | |
$pmprodon_original_initial_payment = $level->billing_amount; | |
//add donation | |
$level->billing_amount = $level->billing_amount + $donation; | |
} | |
return $level; | |
} | |
add_filter("pmpro_checkout_level", "pmprodon_pmpro_donation_recurring", 99); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Brilliant. Any tips on how to get this into the admin panel as an optional checkbox for a membership level?