User list sorting of results

2 weeks 3 days ago - 2 weeks 3 days ago #316126 by galanopd
Hi,

Is it possible to sort the userlist results according to some hierarchy in Joomla (ACL) `usergroups` table?

As far as I can understand I can only sort by cb tables, correct?

Thanks
2 weeks 2 days ago #316140 by krileon
For the Basic sorting yes you can only sort by CB fields. For Advanced sorting you can supply your own SQL to sort by. The usergroup table in most cases however is not joined to the query and is handled entirely in a fast indexed subquery so you likely will not be able to sort by it without providing the full subquery for the usergroup table.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Templates - CBSubs - Hosting - Forge - Incubator - GroupJive
--
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 EST to 4:00 PM EST. 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: galanopd
2 weeks 2 days ago - 2 weeks 2 days ago #316152 by galanopd
Hi krileon,

As far as I understand you say that it is possible but with the proper syntax, correct?

I tried this (SELECT `id` FROM `#__usergroups` WHERE `id` BETWEEN '10' AND '23' ORDER BY `id` DESC) but I get error

1242 Subquery returns more than 1 row.

So since it is normal and expected to return more than 1 row, why am I getting this error


Thanks
1 week 6 days ago #316200 by krileon
Your subquery can indeed return more than 1 row. You also didn't make the subquery specific to any given user row. You'll need to of course write your subquery to limit the results to 1 encase a user does have more than 1 usergroup. Joining usergroups to the userlist table is inefficient which is why we don't do it anymore as it'd cause a result set of a million users to take 10x as long. It's also an invisible metric to be sorting users by so doesn't really benefit users much.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Templates - CBSubs - Hosting - Forge - Incubator - GroupJive
--
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 EST to 4:00 PM EST. 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: galanopd
1 week 6 days ago #316206 by galanopd
Ok krileon,

I think you are right... I will try to work it out another way.
Maybe I'll use a field at registration stage and then sort the user list according to this field. Much easier!

Thanks for your help!

Galanopd
Moderators: beatnantkrileon
Time to create page: 0.423 seconds

Facebook Twitter LinkedIn