Skip to Content Skip to Menu

Queries maybe? To pull fields of a specific group?

12 years 4 months ago #201758 by marriage_minded_man
Queries maybe? To pull fields of a specific group? was created by marriage_minded_man
Ok. I have a group of users (in a user group), who have the ability to fill out their Youtube username into a field. I'm currently using that field to display their channel through a youtube embed code (very cool, thanks to your help).

Now, what I'd like to do is have a page that pulls up all their youtube channels with their username (linked to their profile). So a user can go to this page and view the videos on the channel they like, and click the username if they want to go tot heir profile.

So I'm thinking the code would look something like this but I just dont know how to put it together.

if usergroup equals "specificusergroup", then display <div> username linked to profile <br>channel embed code [cb_youtubeusername]</div> and then repeat until the end of the database or paginate somehow after like 12 times or something.

How do I do this?

And will I have to make this so that the user viewing this page is logged in or can I make it so that the page content is available to public users. Not sure where to start.

Thanks.

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

12 years 4 months ago #201785 by pepperstreet
Since there are no "loops" in substitutions, I doubt that there is a dynamic solution. The only quick idea are CB user lists. One list sorted by channel. Or create multiple lists!?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
12 years 4 months ago - 12 years 4 months ago #201813 by krileon
If I understand correctly you want to display a youtube embed based off their usergroups. You should be able to do this with the following IF substitution.

[cb:if gids includes "8"]I am Super User[/cb:if]

Where 8 is replace it with whatever usergroup id you want. Then replace the content inside the IF substitution with whatever you want.

If you need to show multiple rows for a database with substitution support then you can use CB Query Field to do this. See example below.

Query:
Code:
SELECT * FROM `#__users`
Mode: Internal
Output: Multiple Rows
Row:
Code:
<div>[column_username]</div>

You could then place the query field in your delimiter field with the IF substitution to ensure it only shows for users of a specific usergroup.


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: 12 years 4 months ago by krileon.

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

12 years 4 months ago #201849 by marriage_minded_man
Replied by marriage_minded_man on topic Re: Queries maybe? To pull fields of a specific group?
Ok. I just learned IF statements just recently. So I understand the first portion of what you said.


So where do I learn about queries, how do they work, tutorials etc. Do I put the codes you just showed inside the delimiter field. Sorry you'll have to excuse my ignorance. I'm learning a lot, so thank you. Are there tutorials on queries or documentation?
The following user(s) said Thank You: pepperstreet

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

12 years 4 months ago - 12 years 4 months ago #201866 by pepperstreet
(OMG, the second time i hit the thankyou button instead of submit, i guess my screenresolution is too high :-) )

You should try W3Cschools for a comprehensive overview plus tutorials. There are a lot of other short tutorials around the web... unfortunately, there seems to be no site like selfHTML or selfPHP.

Additionally, you have to study CB and Joomla specific DB table structures. (on a backup!)
Last edit: 12 years 4 months ago by pepperstreet.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
12 years 4 months ago #201891 by krileon

So where do I learn about queries, how do they work, tutorials etc. Do I put the codes you just showed inside the delimiter field. Sorry you'll have to excuse my ignorance. I'm learning a lot, so thank you. Are there tutorials on queries or documentation?

Besides the example I've provided you I recommend pepperstreets advice as we can't teach you MYSQL, sorry. Below is MYSQL documentation as well to help understand database functions and query structure further.

dev.mysql.com/doc/refman/5.6/en/index.html

The example I provided is to be used with the CB Query Field. It'll query the database for all your users and display their usernames 1 after another as a field on users profiles. You can use this to your advantage and query whatever database you need information from as well as make the query more specific with substitutions.


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.

Moderators: beatnantkrileon
Powered by Kunena Forum