Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Set a specific expiration date for a Membership Level.
For a level to expire on a certain date.
(Note, this will need to be tweaked to work with PayPal Standard.)
function my_pmpro_checkout_level_specific_expiration($level)
//ignore renewals (they will be pushed out one payment period)
return $level;
//add to this array (level ID) => (expiration date in yyyy-mm-dd)
$nextyear = intval(date("Y")) + 1;
$custom_expirations = array("1" => $nextyear . "-01-01");
//needed below
$todays_date = current_time('timestamp');
//check the passed level against your array
foreach($custom_expirations as $level_id => $expiration_date)
//custom expiration?
if($level->id == $level_id)
//how many days until expiration?
$time_left = strtotime($expiration_date) - $todays_date;
if($time_left > 0)
$days_left = ceil($time_left/(60*60*24));
//update number and period
$level->expiration_number = $days_left;
$level->expiration_period = "Day";
return $level; //stop
//expiration already here, don't let people signup
$level = NULL;
return $level; //stop
return $level; //no change
add_filter("pmpro_checkout_level", "my_pmpro_checkout_level_specific_expiration");

This comment has been minimized.

Copy link

commented Feb 16, 2014

This is a great add-on to the PMPro, would love it even more if it were integrated, so the Subscription text reflected it, as well as the functionality of my_pmpro_level_expiration_text.php was also possibly integrated.

I look forward to the enhancement for recurring paypal standard support to on a set date.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.