Skip to Content Skip to Menu

[SOLVED] Placing a user on top of a list

  • fribse2011
  • fribse2011
  • OFFLINE
  • Posts: 921
  • Thanks: 79
  • Karma: 8
9 years 5 months ago - 9 years 5 months ago #264929 by fribse2011
[SOLVED] Placing a user on top of a list was created by fribse2011
Hi Guys

I have a problem that I can't figure out how to make work.
We are a volunteer union and we have some groups that have different tasks for our diving club.
Each of these groups have a chairman.
The groups are set up as Joomla groups, a group has a special forum in Kunena set up for internal discussions.
The groups can be displayed, they are shown as CB lists.
I would like to mark the chairman in the list somehow.
First I had an idea that I could use a radiobutton, and just mark a person as chairman for that list.
But a member that is chairman in one group can participate in another group as an ordinary member, so I can't do it that simple.
Anybody that has an idea on how to solve this?

Best regards
Fribse

Frømandsklubben Nikon, www.nikondyk.dk
We're a volunteer driven diving club in Ishøj, Denmark.
Har du brug for en dykkerklub der rummer alle, så kom ned til os.
Last edit: 9 years 5 months ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48477
  • Thanks: 8281
  • Karma: 1443
9 years 5 months ago #264931 by krileon
Replied by krileon on topic Placing a user on top of a list
The Joomla usergroup table is joined with the userlist query already so you should be able to use its columns in the order by of your userlist. The alias is "g". So for example g.`group_id` is the group id (note users have have multiple of these). An alternative is to do a sub query for the order by to see if they have a specific group and if they do return 1 otherwise 0 then order by the normal ordering (e.g. username).


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.

  • fribse2011
  • fribse2011
  • OFFLINE
  • Posts: 921
  • Thanks: 79
  • Karma: 8
9 years 5 months ago #264978 by fribse2011
Replied by fribse2011 on topic Placing a user on top of a list
Hi Kyle
But I don't want users to be alfabetically sorted.
Let me expand a bit

Group1
Søren (chairman)
Birger
Martin

Group2
Martin (chairman)
Kenneth
Thomas

Currently I just sort alfabetically.

Best regards
Fribse

Frømandsklubben Nikon, www.nikondyk.dk
We're a volunteer driven diving club in Ishøj, Denmark.
Har du brug for en dykkerklub der rummer alle, så kom ned til os.

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

  • fribse2011
  • fribse2011
  • OFFLINE
  • Posts: 921
  • Thanks: 79
  • Karma: 8
9 years 5 months ago #264979 by fribse2011
Replied by fribse2011 on topic Placing a user on top of a list
Ahh, wait a minute, I think I'm getting closer to what you say.
I create a field and put the group id in that, then under sort I enter the advanced, and there create some sort of query. Or is that not what you are saying?
I'm unfortunately not that good with sql queries to do that.

Best regards
Fribse

Frømandsklubben Nikon, www.nikondyk.dk
We're a volunteer driven diving club in Ishøj, Denmark.
Har du brug for en dykkerklub der rummer alle, så kom ned til os.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48477
  • Thanks: 8281
  • Karma: 1443
9 years 5 months ago #265006 by krileon
Replied by krileon on topic Placing a user on top of a list
No, you don't need to create any sort of field. You need to edit your userlist within CB > List Management then under Sort By click Advanced. Now you can supply custom SQL that'll be used as the userlists Order By statement in its query. As the usergroup table is already joined you're able to access its columns with the "g" alias as stated above. Just a quick simple example would be as follows.

g.`group_id`, u.`username` ASC

You'd need to take it a step further and likely have an IF statement to check the value of group_id so you can better control who is ordered first.


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.

  • fribse2011
  • fribse2011
  • OFFLINE
  • Posts: 921
  • Thanks: 79
  • Karma: 8
9 years 5 months ago - 9 years 5 months ago #265149 by fribse2011
Replied by fribse2011 on topic Placing a user on top of a list
Hi Kyle

I'm sorry, I'm completely lost :unsure: .
If I don't create an extra field, how do I then mark whos is the chairman for that group?
Are you suggesting creating an SQL that I need to modify if the chairman changes?

Best regards
Fribse

Frømandsklubben Nikon, www.nikondyk.dk
We're a volunteer driven diving club in Ishøj, Denmark.
Har du brug for en dykkerklub der rummer alle, så kom ned til os.
Last edit: 9 years 5 months ago by fribse2011.

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

Moderators: beatnantkrileon
Powered by Kunena Forum