Find user with level 1-3, in spite of using level 4 by user?

3 years 1 month ago #324070 by krileon
Only way I can see to do that is have 2 additional dropdowns that are hidden from profile edit/registration, but are searchable that store their values using CB Auto Actions. I don't really see any other way to do this than store extra information. You can use the below usage to handle this behavior, but you'll need to write the necessary PHP or SQL yourself for converting their selected occupation into the other 2 categories.

Global
Triggers: onAfterUserRegistration, onAfterNewUser, onAfterUserUpdate, onAfterUpdateUser
User: Automatic
Access: Everybody
Conditions
Field: Custom > Value
Custom Value: [var1_FIELD_NAME]
Operator: Not Equal To
Value: [var3_FIELD_NAME]

This compares the new value in var1 with the old value in var3 to see if the field changed values. If you also want to make sure the field even has a value then add the below condition as well.

Field: Custom > Value
Custom Value: [var1_FIELD_NAME]
Operator: Not Empty

Be sure to change FIELD_NAME to the actual name of your field. The triggers for the above are explained as follows.

onAfterUserRegistration = frontend registration
onAfterNewUser = backend registration
onAfterUserUpdate = frontend edit
onAfterUpdateUser = backend edit

You can use this with any action type. For example a Query action to update the _comprofiler table, a Field action to update a fields value, a Code action to perform some PHP operations and store a value to the user.


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 1 month ago #324071 by ericmuc
Hi,
Thanks! Someting in this way I had in my mind. Great, I will take this as a base for my further development.
Only one question: does it work also with a field group which is edited with ajax in the frontend?
Thanks, best regards
Eric

Please Log in to join the conversation.

3 years 1 month ago #324072 by krileon

Only one question: does it work also with a field group which is edited with ajax in the frontend?

The triggers and conditions should, yes. However it significantly increases the difficulty of what you're trying to do since you now need to handle processing the JSON, finding the occupation, converting that to the other categories and then store those.


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: ericmuc

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.492 seconds

Facebook Twitter LinkedIn