Skip to Content Skip to Menu

User list sorting of results

  • galanopd
  • galanopd
  • OFFLINE
  • Posts: 374
  • Thanks: 49
  • Karma: 8
4 years 10 months ago - 4 years 10 months ago #316126 by galanopd
User list sorting of results was created 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
Last edit: 4 years 10 months ago by galanopd.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48495
  • Thanks: 8284
  • Karma: 1443
4 years 10 months ago #316140 by krileon
Replied by krileon on topic User list sorting of results
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 - 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: galanopd

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

  • galanopd
  • galanopd
  • OFFLINE
  • Posts: 374
  • Thanks: 49
  • Karma: 8
4 years 10 months ago - 4 years 10 months ago #316152 by galanopd
Replied by galanopd on topic User list sorting of results
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
Last edit: 4 years 10 months ago by galanopd.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48495
  • Thanks: 8284
  • Karma: 1443
4 years 9 months ago #316200 by krileon
Replied by krileon on topic User list sorting of results
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 - 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: galanopd

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

  • galanopd
  • galanopd
  • OFFLINE
  • Posts: 374
  • Thanks: 49
  • Karma: 8
4 years 9 months ago #316206 by galanopd
Replied by galanopd on topic User list sorting of results
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

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

Moderators: beatnantkrileon
Powered by Kunena Forum