Skip to Content Skip to Menu

[SOLVED] Get usergroup for condition in Auto Actions

10 years 5 months ago - 10 years 5 months ago #244900 by avateamcom
Hi,

I need to set a field value upon a members usergroups. I cannot find any substitution for that. Is is possible in any way?

Example:
A new user registeres to a site and chooses in a dropdown-list, if he is either "Manager" or "Taxidriver". He gets automatically assigned to usergroup "ManagersGroup" or "TaxidriversGroup". Now a separate field called "HasTaxiLicense" should be set to strings "no" for the manager or "yes" for the taxidriver by default upon registration, but the field should not be shown during registration or in usertabs at the frondent, because it is only for internal use.
The easiest way for me would be if i can check the assigned group with triggers "onAfterUserRegistration,onAfterUserUpdate,onAfterUpdateUser". This updates the field even if the user changes his employment from manager to taxidriver.. :)

How can I solve this? Maybe theres a was for substituting a sql-select?

Thanx in advance for your help!

Stefan
Last edit: 10 years 5 months ago by krileon.

Please Log in or Create an account to join the conversation.

10 years 5 months ago #244932 by avateamcom
Replied by avateamcom on topic Get usergroup for condition in Auto Actions
Hi all,

I solved it on my own with the absolutely great cb-plugin "CB MySQL Field".

The query

SELECT title FROM jos_usergroups, jos_user_usergroup_map WHERE jos_user_usergroup_map.group_id = jos_usergroups.id AND jos_user_usergroup_map.user_id = '{USERID}'

with a delimiter ","

gets me all usergroups of the user which then can be used as condition "Does Contain" or "Does Not Contain" in CB Auto Actions.

Thanks for these great plugins! :)

Stefan

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8282
  • Karma: 1443
10 years 5 months ago #244946 by krileon
Replied by krileon on topic Get usergroup for condition in Auto Actions
Just have 2 actions act on the field value. There's no need to check the actual usergroups if you've a CB field that represents them.

Please also note we've a CB Query Field plugin that provides query output as field values with substitution support and much much more.


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 or Create an account to join the conversation.

10 years 5 months ago - 10 years 5 months ago #244955 by avateamcom
Hi Kyle,

thank you for your reply. I just did it through the MySQL-Field and that works like it should. I don't have a separate field representing the usergroups, but the MySQL-Field just does that job.. :)

Stefan
Last edit: 10 years 5 months ago by avateamcom.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum