change the user group

9 months 1 week ago #307910 by AlecsRU
You misunderstood me. I'm not talking about your demo site. On my site, I'm trying to make a change to the access rights of a user who fills in a specific field in the profile and updates the profile

Here's what I did:

Created a Yes and No combo box.
The user selects Yes and should automatically change the access level
I selected trigger "onafterfieldrow", user access level "Registered", type " Uesrgroup"
In the second tab " Conditions "I specified the field name [cb_demo], operator" Equal "and value"Yes".
In the third tab I specified to change the user group from" Registered "to"Demo group".
As a result of activation of the trigger (before changing a record in a field) on my website in the personal account of the user 504 error. The same error is in the administrative panel of this user.

I would be grateful if you could explain my mistake.
9 months 1 week ago #307918 by krileon
To change the usergroup based off the value of a field you'll need to check for the after update or after registration triggers where you want this to be applied. For example the below will work for frontend and backend registration and profile update.

Triggers: onAfterUserRegistration, onAfterNewUser, onAfterUpdateUser, onAfterUserUpdate
Type: Usergroup
User: Automatic
Access: Everybody
1: [var1_cb_demo] Not Equal To [var3_cb_demo]
2: [cb_demo] Equal To 1

With the conditions the first one is checking if the field value changed from what it previously was otherwise it would change their usergroup constantly when updating their profile when the checkbox field is checked. As for conditioning against a checkbox field to see if they've checked it you need to condition against a value of 1 or 0|Empty. 1 being checked and 0|Empty being unchecked (it's more reliable to use Equal To 1 or Not Equal To 1).

Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Templates - CBSubs - Hosting - Forge - Incubator - GroupJive
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 EST to 4:00 PM EST. 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: nant
Moderators: beatnantkrileon
Time to create page: 0.376 seconds
Facebook Twitter Google LinkedIn