3

I have a website with Craft CMS 2 and this site has 2 diffrent languages.

There is no problem with sending e-mail for account activation for each language but when a user tries to activate his/her account via e-mail for my second language which is English they see English mail template but link directs them to my first and default language which is Turkish.

Same problem with the "Forgot my password" link. I tried to add array to activateAccountSuccessPath for each local like siteUrl but could not take any solution. Always directs to tr locale after activation from English mail template.

1

When you register/save the user you need to set their preferredLocale, so Craft adjusts the verification URL sent with the activation email accordingly. Craft uses the primary locale for a user who doesn’t have a preferred locale set.

You can do this using a hidden input field in the registration form, or via a users.beforeSaveUser event listener.

<input type="hidden" name="preferredLocale" value="{{ craft.locale }}">

Once your users have a preferred locale set, your localized activateAccountSuccessPath config should work.

| improve this answer | |
  • thanks for helping to solve my issue! Your code works fine and do what i need. – Berk Can Demir Jul 19 '18 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.