[SOLVED] Individual Reg Mails depending on profiletype

8 years 4 months ago - 8 years 4 months ago #275710 by uncleron12345
Hello,

I tried to customize the emails which are sent to user after registration.

The Original in de-de language looks like

'YOUR_REGISTRATION_IS_PENDING_APPROVAL_MESSAGE' => "Hallo [NAME],\r\nDanke für die Registrierung. Wir haben\r\ndie Registrieranfrage ...",

...and so on


I'd like to change "Name" to cb fields depending on profiletype.
A-Users should receive email with Hello "cb_vorname" "cb_nachname" (firstname, lastname)
F-Users should receive email with Hello "cb_unternehmen" (company name)


So I tried it with substitutions in the way I use them normally:

'YOUR_REGISTRATION_IS_PENDING_APPROVAL_MESSAGE' => "Hallo [cb:if cb_profiletype="a-profil"][cb:userfield field="cb_vorname" /] [cb:userfield field="cb_nachname" /][/cb:if][cb:if cb_profiletype="f-profil"][cb:userfield field="cb_unternehmen" /][/cb:if],\r\nDanke für die Registrierung. ...",

...and so on


After saving language file I receive an sitewide 500 internal Server error.


Where's my mistake? :whistle:

Thanks in forward and merry x-mas :) :) :)

Best,
René

Please Log in to join the conversation.

8 years 4 months ago #275753 by krileon
Replied by krileon on topic Individual Reg Mails depending on profiletype
IF substitutions are the way to go, but you have PHP errors in your string. You're using " in your language string, but the string variable is encased in ". You need to be using an IDE like Netbeans or PHPStorm so you can see PHP errors. Replace the " surrounding the string with ', but if you're also using ' you'll need to escape either " or ' usages as needed with a backslash.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

8 years 4 months ago - 8 years 4 months ago #275763 by uncleron12345
Replied by uncleron12345 on topic Individual Reg Mails depending on profiletype
thanks for your reply.

I replaced " with '. Now it looks like:

'YOUR_REGISTRATION_IS_PENDING_APPROVAL_MESSAGE' => 'Hallo [cb:if cb_profiletype=\'a-profil\'][cb:userfield field=\'cb_vorname\' /] [cb:userfield field=\'cb_nachname\' /][/cb:if][cb:if cb_profiletype=\'f-profil\'][cb:userfield field=\'cb_unternehmen\' /][/cb:if],<br><br>\r\nDanke für die Registrierung.

There is no more error shown, but in E-Mail the field values for name / company name aren't shown. just a blank space.


with [cb:if cb_profiletype='a-profil' ... or [cb:if cb_profiletype="a-profil" ...
the same. No error, but no name in emails.


Where's my mistake? :unsure:

Please Log in to join the conversation.

8 years 4 months ago - 8 years 4 months ago #275777 by krileon
Replied by krileon on topic Individual Reg Mails depending on profiletype
You only needed to replace the PHP " usages surrounding your string. The substitutions needed to remain as is as we don't scan for ' in our substitution parsing so nothing will substitute with your above usage. Example as follows based off your original string.

FROM:
'YOUR_REGISTRATION_IS_PENDING_APPROVAL_MESSAGE'	=>	"Hallo [cb:if cb_profiletype="a-profil"][cb:userfield field="cb_vorname" /] [cb:userfield field="cb_nachname" /][/cb:if][cb:if cb_profiletype="f-profil"][cb:userfield field="cb_unternehmen" /][/cb:if],\r\nDanke für die Registrierung. ...",
TO:
'YOUR_REGISTRATION_IS_PENDING_APPROVAL_MESSAGE'	=>	'Hallo [cb:if cb_profiletype="a-profil"][cb:userfield field="cb_vorname" /] [cb:userfield field="cb_nachname" /][/cb:if][cb:if cb_profiletype="f-profil"][cb:userfield field="cb_unternehmen" /][/cb:if],\r\nDanke für die Registrierung. ...',

Again, you won't have any of these issues with a proper IDE as it'd error that string. Please see the below for further PHP syntax basics.

www.w3schools.com/php/default.asp


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

8 years 4 months ago #275782 by uncleron12345
Replied by uncleron12345 on topic Individual Reg Mails depending on profiletype
thanks, I've tried and also copied your code, but there there's only a blank space shown in emails.

when the string and substitutions are correct, where else could be the issue? :unsure:

Please Log in to join the conversation.

8 years 4 months ago #275784 by krileon
Replied by krileon on topic Individual Reg Mails depending on profiletype
Either the fields your substituting have no value, the field names are wrong, or the value you're IF checking against could be wrong. I've no idea your field setup. The fields also need to be accessible to the user. If they're on a tab the users usergroup can't access then they will not be able to see the substituted value. You can substitute in raw values using [FIELD_NAME] which will ignore the access checks.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: uncleron12345

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.201 seconds

Facebook Twitter LinkedIn