strangerstudios / pmpro-reason-for-cancelling

Require members to provide a reason for leaving before they can cancel their membership.
https://www.paidmembershipspro.com/add-ons/pmpro-reason-cancelling/
13 stars 10 forks source link

BUG: Not adding reason for cancellation to cancel email when using localized email template #18

Closed ipokkel closed 5 days ago

ipokkel commented 3 years ago

When cancelling a membership level the reason for cancellation is not included in the email template if the site language is set to any locale for which PMPro core has translated email templates available under languages/email/ as the text replacement code only checks for the default English string and not strings for other locales.

We should consider checking the string that the reason is added to for each locale for which a translated email template set is available.

Steps to reproduce:

  1. Set site language to French under Settings > General
  2. On the Membership Account page, select to cancel active membership.
  3. Fill in the reason for cancellation and submit.
  4. Check the "cancel" email sent to the user and site administrator.

Alternatives: Can use a customization recipe that checks per language locale, e.g https://gist.github.com/ipokkel/f6a4e868919b038401d601bfc0e35c98

Admin Only: Ticket - https://www.paidmembershipspro.com/forums/topic/reason-for-cancelling-addon/

kimcoleman commented 2 years ago

It looks like there is code in the current version to find a "variable" like !!reason!! and replace that. I think this is the fall back if it can't find the string to append to.

https://github.com/strangerstudios/pmpro-reason-for-cancelling/blob/0d7f63a9feb6800e7d343cc768aefd2373da77cb/pmpro-reason-for-cancelling.php#L61

I'm also doing a PR to add a new "template variable" !!reason_for_cancelling!! that people can use which adds this as a data value the correct way.