Last active
November 15, 2017 06:57
-
-
Save ideadude/0762f2e9e4a2239b796d1a761558b871 to your computer and use it in GitHub Desktop.
Redirect the Paid Memberships Pro confirmation to a page for a specific upsell unless the user already has that 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
<?php | |
/* | |
Redirect to a URL promoting an upsell unless the user already has that level. | |
Add this code into a custom plugin. | |
*/ | |
function pmpro_confirmation_url_to_upsell($rurl, $user_id, $pmpro_level) { | |
$upsell_level_id = 2; //change this | |
$upsell_url = 'https://example.com/upsell-page/'; //change this | |
if(!pmpro_hasMembershipLevel($upsell_level_id, $user_id)) | |
$rurl = $upsell_url; | |
return $rurl; | |
} | |
add_filter('pmpro_confirmation_url', 'pmpro_confirmation_url_to_upsell', 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment