strangerstudios / pmpro-sponsored-members

Generate a discount code for a main account holder to distribute to sponsored members.
https://www.paidmembershipspro.com/add-ons/pmpro-sponsored-members/
15 stars 27 forks source link

An unlimited use discount code created under certain conditions if seat cost is 0 #128

Open dwanjuki opened 1 year ago

dwanjuki commented 1 year ago

Describe the bug When the seats parameter is omitted from the $pmprosm_sponsored_account_levels array and if the sponsored seats are free, checking out for a sponsor level without creating any child accounts creates an unlimited use discount code.

An unlimited use discount code is also created if a parent account is imported from CSV.

To Reproduce Steps to reproduce the behavior:

  1. Setup your $pmprosm_sponsored_account_levels array. Omit seats and set seat_cost to 0
  2. Check out for the sponsored level. Do not create any seats at checkout.
  3. Check Memberships > Settings > Discount Codes
  4. Observe that the discount code created has unlimited uses.

Expected behavior Number of discount code uses is limited

Isolating the problem (mark completed items with an [x]):

WordPress Environment

WP 6.2 PMPro 2.10.5 PMPro Sponsored Members 0.10.1