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

Duplicate INSERT with the same code_id and user_id in the table wp_pmpro_discount_codes_uses #144

Open ipokkel opened 11 months ago

ipokkel commented 11 months ago

Describe the bug A customer reported the following:

The plugin allow duplicate INSERT with the same code_id and user_id in the table wp_pmpro_discount_codes_uses which set a wrong available seats and block next sponsored user to register (when the max seats is reach).

This happens here.

https://github.com/strangerstudios/pmpro-sponsored-members/blob/89ccaa6b629e446af32efdd8a1d56ea07130aca5/pmpro-sponsored-members.php#L295

Expected behavior We should consider adding a check to avoid duplicate submissions.

Additional Information Ticket no. 520675