Skip to content

Instantly share code, notes, and snippets.

@LMNTL
Created June 3, 2019 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LMNTL/68b737fcbb9b36b5703a036aa81c39d2 to your computer and use it in GitHub Desktop.
Save LMNTL/68b737fcbb9b36b5703a036aa81c39d2 to your computer and use it in GitHub Desktop.
Example of using the 'discount_code' attribute to change expiration date for PMPro Sponsored Members
/*
Override the discount code given to sponsored members.
This recipe makes any sponsored members with level 2 expire in 2 days.
The 'discount_code' array supports the following attributes:
code_id, level_id, initial_payment, billing_amount, cycle_number, cycle_period, billing_limit,
trial_amount, trial_limit, expiration_number, expiration_period
Make sure that strings in the _period values are wrapped in single quotes, e.g. 'expiration_period' => "'Year'"
*/
global $pmprosm_sponsored_account_levels;
$pmprosm_sponsored_account_levels = array(
//set 5 seats at checkout
1 => array(
'main_level_id' => 1, //redundant but useful
'sponsored_level_id' => 2, //array or single id
'seats' => 200,
'seat_cost' => 0,
'discount_code' => array(
'expiration_number' => '2',
'expiration_period' => "'Day'"
)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment