Skip to Content Skip to Menu

[SOLVED] Specific Fields for Groups

10 years 2 months ago - 10 years 2 months ago #248475 by tjohns92109
[SOLVED] Specific Fields for Groups was created by tjohns92109
Hi,

I've been looking around and experimenting but haven't found much of a solution here...

I need to have specific fields to only show on specific groups (Group Jive). For example, if I have a group for actors and a field for 'hair color', I wouldn't want that field to show in the group for stage crew employees.

Do you know what the best way would be to accomplish this? Or if there's documentation that I missed, could you direct me to it?

Thanks!
Last edit: 10 years 2 months ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48479
  • Thanks: 8283
  • Karma: 1443
10 years 2 months ago #248501 by krileon
Replied by krileon on topic Specific Fields for Groups
Best way to do that is probably a CB Query Field to query for the groups the user has or a specific group you're wanting to test against then have it return a value that could be conditioned. You'd then use CB Conditional and instead of selecting a field to condition against select Custom > Value. Next supply a substitution for your query field then condition against it as needed depending on what the query returns. For example if your query field returns a 1 if the user is in the group and a 0 if they are not you could use the below.

Field: Custom > Value
Value: [cb_myqueryfield]
Operator: Equal To
Value: 1
Mode: Show


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

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

10 years 2 months ago #248511 by tjohns92109
Replied by tjohns92109 on topic Specific Fields for Groups
Thanks, Kyle, for the detailed instruction. Awesome support!
The following user(s) said Thank You: krileon

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

10 years 2 months ago - 10 years 2 months ago #248641 by tjohns92109
Replied by tjohns92109 on topic Specific Fields for Groups
I was wondering if there is any kind of documentation for the CB Query field or CB Conditional. I searched the manual and didn't find anything.

What I'm wondering is... if I have 10 groups with 20 fields specific to each group... am I going to need 200 query field and conditionals for these?

When you say 'query for the groups the user has', What table would I even query from? Since Group Jive and Community Builder are pretty much separate entities in the database, I can't find any kind of connection or table that I can query that from.
Last edit: 10 years 2 months ago by tjohns92109. Reason: more specific yet

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

10 years 2 months ago #248646 by tjohns92109
Replied by tjohns92109 on topic [SOLVED] Specific Fields for Groups
PLEASE READ FIRST

I think I found a 'work-around' that I'm more comfortable with. I'll let you know if it works and what I did, but will leave my prior post for reference in case it doesn't.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48479
  • Thanks: 8283
  • Karma: 1443
10 years 1 month ago - 10 years 1 month ago #248710 by krileon
Replied by krileon on topic [SOLVED] Specific Fields for Groups
You only need 1 query field. You'll just concat the results and then use a REGEX operator then some regex to match a specific group. Example as follows.


Query:
Code:
SELECT GROUP_CONCAT( `id` SEPARATOR '\n' ) FROM `#__groupjive_groups` WHERE `user_id` = '[user_id]' GROUP BY `user_id`

The above should give you a linebreak separated (much easier to match than comma list) list of group ids. Example results as follows.

1
10
21
31
41
51
61
100

You'd then configure your conditionals as follows. Note it's important to test your query field gives the expected results. Be sure to test it on profile view to ensure it is linebreak separated before moving forward or the REGEX will not work right.

Field: Custom > Value
Value: [cb_myqueryfield]
Operator: Is REGEX
Value: /^DIGIT_HERE$/ or /DIGIT_HERE\s/
Mode: Show

Replacing DIGIT_HERE with 10 for example should match the above as 10 exists in the list. I've provided 2 REGEX you can try in the above encase one doesn't work as expected.


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.
Last edit: 10 years 1 month ago by krileon.

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

Moderators: beatnantkrileon
Powered by Kunena Forum