Setting language field on registration form

2 years 1 month ago #328760 by sentix
I want to create an auto action that allows me set the language tag of the current guest user in the registration form as default.

The "standard" option is not sufficient as i want every user to have dedicated language tag in his params field.

How can I do that?

Versions: CB 2.7.2, J 3.10.6

Please Log in to join the conversation.

2 years 1 month ago - 2 years 1 month ago #328764 by krileon
Replied by krileon on topic Setting language field on registration form
Why are you needing to do this? Their default language will already be the site default language.

There isn't an easy way to do that. User params storage is handled by Joomla. We just call Joomla's user form API to let Joomla deal with it. So those values are not stored in the CB user object. This means you can't use a Field action to do this. Only way is to use a Code action really late in the registration process. Specifically on onAfterUserProfileSaved trigger. Example as follows.

Global
Triggers: onAfterUserProfileSaved
Type: Code
User: Automatic
Access: Everybody
Action
Method: PHP
Code:
JOOMLA_API_TO_SET_PARAM_HERE


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.

2 years 1 month ago - 2 years 1 month ago #328769 by sentix
Replied by sentix on topic Setting language field on registration form
Hello kyle, thanks for your quick reply.

I need it, because in the regular registration process, there will be no language tag stored for the user. But when I want to send mails to the user (e.g. by my own mailing routine), I cannot select by langugage as the necessary string is missing. Only if the user has dedicated selected his frontend language, this works fine.

Any idea for that problem?

Regards
Manfred

Versions: CB 2.7.2, J 3.10.6

Please Log in to join the conversation.

2 years 1 month ago #328771 by krileon
Replied by krileon on topic Setting language field on registration form
Language is stored in their params column of _users. How are you selecting it to begin with?


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.

2 years 1 month ago - 2 years 1 month ago #328785 by sentix
Replied by sentix on topic Setting language field on registration form
I will search for language string in params field (or use JSON related database functionality) ... To sum it up: I want to have every user record to have the frontend language set in the params field.

Versions: CB 2.7.2, J 3.10.6

Please Log in to join the conversation.

2 years 1 month ago #328790 by krileon
Replied by krileon on topic Setting language field on registration form
You shouldn't need to do a store for that. Adjust your SQL to account for empty string when querying for the default language. Example as follows.

FROM:
WHERE `params`->"$.language" = 'ja-JP'
TO:
WHERE `params`->"$.language" = 'ja-JP' OR `params`->"$.language" = ''

If you still want this your only option is as described above. You'll have to use Joomla API to update the Joomla user object and set the language.


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.

Moderators: beatnantkrileon
Time to create page: 0.311 seconds

Facebook Twitter LinkedIn