How to force users to update a read only field on next login?

3 years 2 months ago #323071 by tto
Hello

I created a "Radio Buttons" field, with two values, "personal" and "companies".
Read Only. Show on registration, hide on profile/profile edit.

And I created two auto-actions to assign users to Joomla group "Personal" or "Companies".

The 1st (personal):
Triggers: onAfterNewUser, onAfterUpdateUser, onAfterUserRegistration, onAfterUserUpdate
Type: Usergroup
User: Automatic
Access: Everybody

Conditions :
Field : cb_usertype
Operator : Equal To
Value : Personal

Action:
Add Usergroups : Personal
Remove Usergroups : Company

The 2nd (company):
Triggers: onAfterNewUser, onAfterUpdateUser, onAfterUserRegistration, onAfterUserUpdate
Type: Usergroup
User: Automatic
Access: Everybody

Conditions :
Field : cb_usertype
Operator : Equal To
Value : Comapny

Action:
Add Usergroups : Company
Remove Usergroups : Personal

Working fine for new users on registration, but what can do with my current registered users?

Thanks,

Regards,

Tariq

Please Log in to join the conversation.

3 years 2 months ago #323081 by krileon

but what can do with my current registered users?

Probably easiest approach is to filter your users within CB > User Management then use the Batch Tool to assign users to the appropriate groups that have already registered.

So first you'll want to click Search Tools and filter at the bottom with the field filter by the same condition you're using in your auto action. Now you should be able to use the check all checkbox in the table to select everyone. Next you can use usergroups dropdown under Batch Tools to mass assign the usergroup change.


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.

3 years 2 months ago - 3 years 2 months ago #323126 by tto
Thank you for your reply Kyle

You see I have +130k users, and I don't know who would like to set his account as a company or as a personal account, but I want all of them to do so to continue using the site, so I was thinking to force user to update profile after login.

I did this:

1- I created a new Tap with condition to hide on usergroup "personal" or "company".
2- I changed the Field to be editable and Required, show on registration and edit, moved the Field to the new Tap,
3- I created a new Auto Action, Redirect on joomla_onUserAfterLogin, onAfterUserLoginSuccess, Condition Usergroup Does not have "Company" or "Personal", to profile edit URL.

It is working fine, but the user can navigate to other pages and skip profile edit.

Is it possible to force them to update profile before browsing any site page?

Thanks

Regards,

Tariq

Please Log in to join the conversation.

3 years 2 months ago #323141 by krileon

Is it possible to force them to update profile before browsing any site page?

Probably using a Joomla trigger early in the renderer process, but you'd be at significant risk of breaking your site trying to redirect everything to profile edit. Review Joomla events below if you still want to consider implementing this. You'll need to do various checks against the current URL they're on, etc..

docs.joomla.org/Plugin/Events

In CB Auto Actions be sure to prefix all Joomla events with joomla_.


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.213 seconds

Facebook Twitter LinkedIn