[SOLVED]Simplifying my Question: user groups [usergroup]

11 years 5 months ago - 11 years 5 months ago #215061 by cberry1971
I am getting all twisted up trying to figure out how to create Auto Actions / Conditionals etc based on user group.

Example:

Athlete A belongs to User Group "Athlete"
Event Creator B belongs to User Group "Event"
Both belong to User Group "Registered"

All I want to do is
1. display a tab (conditional) to Athlete A and a different tab to Event Creator B
2. create a user profile title based on Athlete A [cb:if usergroup="Athlete"].....[/cb:if] to display Athlete: [name]
3. create a user profile title based on Athlete B to display Event: [cb_eventname]

Sorry for being so dense.

Please Log in to join the conversation.

11 years 5 months ago #215083 by krileon
1. With CB Conditionals installed and published edit your Tab of choosing then create a conditional based off the User Group field with operator Not Equal To and value of Athlete then set its display to hide. This should hide it for anyone that's not an Athlete. You need to adjust the operator/value as needed based off how this field is stored in the database.

2. You can use a delimiter field to do this or you can try editing the profile title tab and supply your own title string to its input parameter.

3. See #2, but expand your IF further as needed.


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.

11 years 5 months ago - 11 years 5 months ago #215102 by cberry1971
I don't see a User Groups field in _comprofiler that is the issue. I thought (from other posts) i could use [usergroup] similar to [name] as a system generated field....

I since [usergroup] did not work, I have created a query type field called User Group.

In tabs I have settings as per screenshot #1. I have tried "equal to" and "contains"

Also added the User Groups Field settings in screenshot #2
Thanks for your patience. I am also feeling stressed by this topic.
Attachments:

Please Log in to join the conversation.

11 years 5 months ago - 11 years 5 months ago #215107 by krileon
Your query is fine, but if the user has more than 1 usergroup it probably won't work as expected as it'll output the first usergroup row it finds for the user. You need to check what it looks like on profile then see about matching against it. Query fields aren't guaranteed to work with CB Conditional as it's not designed for it as there is nothing stored in database and nothing to really check against. It'll try to use getField API to grab its value and for it to do that the field needs to be on a public and published tab as well as the field being set to show on profile (the tab can be in a not shown on profile position to hide it).


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.

11 years 5 months ago - 11 years 5 months ago #215108 by cberry1971
Query
SELECT group_id FROM `sfvi3_user_usergroup_map` WHERE user_id=[user_id]

The users are in multiple groups (Registered, Athlete) or (Registered, Affiliate)

I think I am making this too complicated. I can't be the first person to need "if user is in User Group X do Y"

hopefully this helps.

Screenshot from CB User Management of User Groups:

Screenshot #2: query from SQL:
Screenshot #3 results from Query:

#11 is the "Affilate" group for whom I am trying to hide the tab.
Attachments:

Please Log in to join the conversation.

11 years 5 months ago #215114 by cberry1971
OK how do I user group into a "_comprofiler" field if I can't use query field? I think that is the question.

For those painfully following along. The attempt to reduce the rows in the query does not work.
SELECT group_id FROM sfvi3_user_usergroup_map WHERE user_id=[user_id] AND group_id <> 2

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.268 seconds

Facebook Twitter LinkedIn