strangerstudios / paid-memberships-pro

The Trusted Membership Platform That Grows with You: Restrict access to content and charge recurring subscriptions using Stripe, PayPal, and more. Fully open source. 100% GPL.
https://www.paidmembershipspro.com
Other
468 stars 360 forks source link

pmpro_get_element_class should take extra params #1549

Open mircobabini opened 3 years ago

mircobabini commented 3 years ago

https://github.com/strangerstudios/paid-memberships-pro/blob/e9f3afe0cd153793d31a10fee74f985859c03736/pages/checkout.php#L22

I think that pmpro_get_element_class should take extra params to be more filterable.

Check the case above: if I have 30 memberships, I must add 30 pmpro_element_class filters to add a class for every memeberships.

So, I would suggest to change the pmpro_get_element_class to accept any extra params to be passed to the filter (extra context informations).

mircobabini commented 3 years ago

I won't send a pull request until I get some feedback from you.

Meanwhile, I just prepared a demo of what I mean (and run successful tests on it):

Check this gist revision, on which I changed the pages/checkout.php line above and the pmpro_get_element_class implementation to accept the extra args. https://gist.github.com/mircobabini/762c3a60c95ce2740d7cd11670bc3fab/revisions?diff=unified

The new implementation extracted: https://gist.github.com/mircobabini/ee4f32be704e67b1f3e581c45e9c5364