Skip to Content Skip to Menu

[SOLVED] Specific Fields for Groups

10 years 1 month ago #248841 by tjohns92109
Replied by tjohns92109 on topic [SOLVED] Specific Fields for Groups
Thanks again, Kyle. You're awesome for taking the time to expand on this.

The reason I was going to find a workaround was that I'm not very 'seasoned' at MySQL queries - So this helps. Except for one thing...

When I put

SELECT GROUP_CONCAT( `id` SEPARATOR '\n' )
FROM `jos_groupjive_groups`
WHERE `user_id` = '[user_id]'
GROUP BY `user_id`

into the query field, it changes the \n's. So I pasted it into my editor first in order to strip anything that came from this page, then pasted it in and I still get an SQL error:

It's still stripping just the 'n' out like below and I'm getting an SQL error...

SELECT GROUP_CONCAT( `id` SEPARATOR '\
' )
FROM `jos_groupjive_groups`
WHERE `user_id` = '[user_id]'
GROUP BY `user_id`

I'm guessing that's why I'm getting this error:

1146 - Table 'tommiet_talentcom.jos_groupjive_groups' doesn't exist SQL=SELECT GROUP_CONCAT( `id` SEPARATOR '\ ' ) FROM `jos_groupjive_groups` WHERE `user_id` = '381' GROUP BY `user_id`

I took a look at the database and noticed that the typical _jos prefix is _netu9 on this installation of Joomla and changed it in the query. This cancelled the error. I turned on 'show empty fields' in the configuration and it just shows a dash (-).

The 'n' is still stripped out so maybe this is now the reason for it showing no results. Is there a way to keep CB from stripping anything out of the SQL?

I took another look at the database and found something. The user id in the database for that table is just the user who created the group... in my case, the administrator created all of them. So I signed in on the front end as the admin and it does work, but not line separated.

So, I guess my question in the end is... is there no way to pull groups that the user has joined (only that the user created)?

Thanks again!

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 #248857 by krileon
Replied by krileon on topic [SOLVED] Specific Fields for Groups
It's not working due to your table prefix not being jos_. It should be #__ in the query so it auto replaces. I've edited my original reply with the query fixed. Please try the below.

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

The linebreak is just being replaced on error display and that's ok. Just make sure the results of the query field display on profile as expected and the condition should work ok.


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.

10 years 1 month ago #248868 by tjohns92109
Replied by tjohns92109 on topic [SOLVED] Specific Fields for Groups
I've actually solved that (noted in last post) by replacing with the correct table prefix. I tried it with #__, but get the same result. Not line-separated and only works to show groups created by the user... not groups joined by that user. Hope that makes sense.

Only when logged in as administrator, I get:
Query Field:
16 10 9 8 15 14 13 12 11 17

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 #248914 by krileon
Replied by krileon on topic [SOLVED] Specific Fields for Groups
Looks like you won't be able to separate by linebreaks. You could try the below, which attempts to match a value from a comma separated list instead.

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

The above gives you a comma separated list of group ids. Example expected results as follows.

10,21,31,41,51,61,71

You'd then need to use the below REGEX to match a value in the comma separated list.

Field: Custom > Value
Value: [cb_myqueryfield]
Operator: Is REGEX
Value:

File Attachment:

File Name: match_comm...gexp.txt
File Size:0 KB

Mode: Show

Note please see the regex in the attached file as forum security doesn't seam to like the pattern.


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.
Attachments:

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

Moderators: beatnantkrileon
Powered by Kunena Forum