Problem/Motivation
A view of users, with sort criteria only sorting on some fields in the user entity... It does NOT sort on creation date, or update date, or most recent login... or anything related to WHEN something happened. Just the content in the user profile.

When a user logs in, and changes a value in their user/UID/edit screen... It changes the sort order of the view.
Those users fly to the top of the view results, but UNDER the first sort criteria.
The first sort criteria is a boolean on the user profile. If its checked, show them first, unchecked below,...
Users who login and edit something move to the top, under that boolean check.
Steps to reproduce
See image above.
user profiles have many fields, some are entity references to taxonomy terms.
the view sorts based on the following.
* A boolean switch
* The weight of a "School" term. (relationship)
* The Weight of a "Major" term. (relationship)
* Last Name
* First Name
When the data was first displayed with this new sort logic, it was correct.
As soon as a user changed a value in their user/UID/edit screen, they popped up to the top of the sort, BELOW the boolean.
This image shows the behavior. The two circled results are user profiles who edited their user/UID/edit screen

The first one is out of order based on last name, but is in the first "school".
The second one, the pink one, should be 2 pages down...
I have tried to change SQL queries and caching... to no result.
Does it have something to do with the relationships on the terms?
we need that to control the sort order based on the weight position for the term -- not the term ID...
The SQL query
SELECT "user__field_phd_candidate"."field_phd_candidate_value" AS "user__field_phd_candidate_field_phd_candidate_value", "taxonomy_term_field_data_user__field_user_school"."weight" AS "taxonomy_term_field_data_user__field_user_school_weight", "taxonomy_term_field_data_user__field_user_major"."weight" AS "taxonomy_term_field_data_user__field_user_major_weight", "user__field_user_last_name"."field_user_last_name_value" AS "user__field_user_last_name_field_user_last_name_value", "user__field_user_first_name"."field_user_first_name_value" AS "user__field_user_first_name_field_user_first_name_value", "users_field_data"."uid" AS "uid", "taxonomy_term_field_data_user__field_user_major"."tid" AS "taxonomy_term_field_data_user__field_user_major_tid", "taxonomy_term_field_data_user__field_user_school"."tid" AS "taxonomy_term_field_data_user__field_user_school_tid"
FROM
{users_field_data} "users_field_data"
LEFT JOIN {user__field_user_major} "user__field_user_major" ON users_field_data.uid = user__field_user_major.entity_id AND user__field_user_major.deleted = '0'
LEFT JOIN {taxonomy_term_field_data} "taxonomy_term_field_data_user__field_user_major" ON user__field_user_major.field_user_major_target_id = taxonomy_term_field_data_user__field_user_major.tid
LEFT JOIN {user__field_user_school} "user__field_user_school" ON users_field_data.uid = user__field_user_school.entity_id AND user__field_user_school.deleted = '0'
LEFT JOIN {taxonomy_term_field_data} "taxonomy_term_field_data_user__field_user_school" ON user__field_user_school.field_user_school_target_id = taxonomy_term_field_data_user__field_user_school.tid
LEFT JOIN {user__roles} "user__roles_value_0" ON users_field_data.uid = user__roles_value_0.entity_id AND user__roles_value_0.roles_target_id = 'student'
INNER JOIN {user__field_user_year} "user__field_user_year" ON users_field_data.uid = user__field_user_year.entity_id AND user__field_user_year.deleted = '0'
LEFT JOIN {user__field_phd_candidate} "user__field_phd_candidate" ON users_field_data.uid = user__field_phd_candidate.entity_id AND user__field_phd_candidate.deleted = '0'
LEFT JOIN {user__field_user_last_name} "user__field_user_last_name" ON users_field_data.uid = user__field_user_last_name.entity_id AND user__field_user_last_name.deleted = '0'
LEFT JOIN {user__field_user_first_name} "user__field_user_first_name" ON users_field_data.uid = user__field_user_first_name.entity_id AND user__field_user_first_name.deleted = '0'
WHERE ((user__field_user_year.field_user_year_target_id = '148')) AND (("users_field_data"."status" = '1') AND ("user__roles_value_0"."roles_target_id" = 'student'))
ORDER BY "user__field_phd_candidate_field_phd_candidate_value" DESC, "taxonomy_term_field_data_user__field_user_school_weight" ASC, "taxonomy_term_field_data_user__field_user_major_weight" ASC, "user__field_user_last_name_field_user_last_name_value" ASC, "user__field_user_first_name_field_user_first_name_value" ASC
LIMIT 25 OFFSET 0
Thoughts?
Thank you!
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | Screenshot 2022-04-25 at 15.17.50.png | 329.52 KB | lendude |
| view_user_results_screenshot_2022-04-20_at_13_20_32.png | 523.34 KB | alphex | |
| views_of_users_screenshot_2022-04-20_at_12_49_54.png | 357.58 KB | alphex |
Comments
Comment #2
alphex commentedtypo fix.
Comment #3
larowlanComment #4
lendudeUsually the culprit is the default click sort order used on the table format in the style settings. Looking at the screenshot this display is using an overridden format. Is the default display using a table? Can you set this display up so that it is not using an override? Does that help?
Comment #6
cilefen commented