Last active
October 4, 2023 09:54
-
-
Save dparker1005/a2285ab30e6e9aeacdcf3eae7ca9967c to your computer and use it in GitHub Desktop.
Modify memberships that are given to users via Zapier. As written, this will change the billing amount shown to $10/year.
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 | |
// Copy from below here... | |
/** | |
* Modify memberships that are given to users via Zapier. | |
* As written, this will change the billing amount shown to $10/year. | |
* | |
* 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/ | |
*/ | |
function my_pmproza_change_level( $level, $user_id, $old_level_status, $cancel_level ) { | |
if ( empty( $_REQUEST['pmpro_zapier_webhook'] ) ) { | |
return $level; | |
} | |
$custom_level = array( | |
'user_id' => $user_id, | |
'membership_id' => $level, | |
'code_id' => '', | |
'initial_payment' => 10, | |
'billing_amount' => 10, | |
'cycle_number' => 1, | |
'cycle_period' => 'Year', | |
'billing_limit' => 0, | |
'trial_amount' => 0, | |
'trial_limit' => 0, | |
'startdate' => current_time( 'mysql' ), | |
'enddate' => 'NULL' | |
); | |
return $custom_level; | |
} | |
add_filter( 'pmpro_change_level', 'my_pmproza_change_level', 10, 4 ); |
Line 34 should be
add_filter
Fixed, thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line 34 should be
add_filter