Skip to content

Instantly share code, notes, and snippets.

@ideadude
Last active November 15, 2017 06:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ideadude/0762f2e9e4a2239b796d1a761558b871 to your computer and use it in GitHub Desktop.
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.
<?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