Skip to Content Skip to Menu

[SOLVED] List Sorting Issue

  • Spiralmind
  • Spiralmind
  • OFFLINE
  • Posts: 259
  • Thanks: 16
  • Karma: 0
6 years 10 months ago - 6 years 10 months ago #299829 by Spiralmind
[SOLVED] List Sorting Issue was created by Spiralmind
Hello, I have my users entered and in a list with 2 sort options enabled.



However, the second sort option is not working right. They are not in order by name. The strange part is if I open on of the user and save them in the backend they are sorted correctly.

This message contains confidential information


You can see here the first 2 after high flyer are sorted on top. Both I had to open and save to get on top.

It appears the ones I added after are on top and the ones that were in they system already are not on the bottom.

Any ideas how to fix this besides opening each one and saving them?
Attachments:
Last edit: 6 years 10 months ago by krileon. Reason: Added [SOLVED] tag to subject

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
6 years 10 months ago #299861 by krileon
Replied by krileon on topic List Sorting Issue
It's working exactly as you've configured it. It first sorts by cb_highflyer then sorts those sorted users by name. Editing and saving them is likely just saving cb_highflyer for users who have a value of NULL for that field in the database. The sorting is just directly adding to the ORDER BY clause of the query so all the sorting is handled by SQL it self.


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.

  • Spiralmind
  • Spiralmind
  • OFFLINE
  • Posts: 259
  • Thanks: 16
  • Karma: 0
6 years 10 months ago #299866 by Spiralmind
Replied by Spiralmind on topic List Sorting Issue
OK, don't really understand what that means if it works after I save them.

What is the solution to sorting them correctly? Can you help me fix this?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
6 years 10 months ago #299877 by krileon
Replied by krileon on topic List Sorting Issue

OK, don't really understand what that means if it works after I save them.

Depends on what the field type is. By default a field created after users exist has a stored value of NULL. Saving them may adjust that, which would adjust the sorting.

What is the solution to sorting them correctly? Can you help me fix this?

The SQL is behaving as expected; there's no PHP side sorting to it. Enable debug mode and you can find the query for the userlist at the bottom of the page something like the below. Run it directly in phpmyadmin and you should see the same results as you do on your userlist. You should see your sorting directly in the ORDER BY clause of the SQL. There's no fixing this beyond understanding how your information is stored and what to expect from it. You can of course specify your own ORDER BY clause in the SQL by using Advanced sorting mode.

Code:
SELECT DISTINCT ue.*, u.*, '' AS 'NA' FROM jos_users u JOIN jos_user_usergroup_map g ON g.`user_id` = u.`id` JOIN jos_comprofiler ue ON ue.`id` = u.`id` WHERE u.block = 0 AND ue.banned = 0 AND ue.approved = 1 AND ue.confirmed = 1 AND g.group_id IN (1, 6, 7, 2, 3, 4, 5, 10, 12, 8) ORDER BY `username` ASC LIMIT 0, 15


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.

  • Spiralmind
  • Spiralmind
  • OFFLINE
  • Posts: 259
  • Thanks: 16
  • Karma: 0
6 years 10 months ago #299888 by Spiralmind
Replied by Spiralmind on topic List Sorting Issue
I am understanding what you meant by this now. I did not realize the new sort field was added after the first batch of users were created. I need to open them and add information to them all anyway so they will be saved once more at least.

If new users are added the sorting should work if no new sort field is added? I just need to know so I can be aware of this.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
6 years 10 months ago #299891 by krileon
Replied by krileon on topic List Sorting Issue
Please see the below MYSQL documentation regarding ORDER BY clause as I'm unsure how to explain it further as it's entirely based off SQL handling the data. Maybe your users are just out of sync if they existed before CB in which case you can fix by running User Synchronization within CB > Tools. If they are out of sync then they don't exist in _comprofiler at all, which would certainly affect the sorting.

dev.mysql.com/doc/refman/5.6/en/order-by-optimization.html


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