1

Craft 3.3.13

This query does not order users correctly.

{% set users = craft.users.groupId(3).orderBy('lastName asc') %}

Bug?

1

Just did a simple test on a fresh install of the latest Craft with 3 users in a user group using this code and the output was what I'd expect:

{% set users = craft.users.groupId(1).orderBy('lastName asc') %}

<ul>
    {% for user in users %}
        <li>{{ user.lastName }}, {{ user.firstName }}</li>
    {% endfor %}
</ul>

Gives:

  • Aardvark, Adam
  • Meadows, Marc
  • Zimmerman, Bob
  • Weird. I checked it pretty thoroughly before giving up. – 4midori Nov 16 '19 at 2:05
  • Are you using PostgreSQL by chance? – Brad Bell Nov 16 '19 at 2:52
  • No, MySQL is the DB. – 4midori Nov 16 '19 at 15:56
  • in that case, ¯_(ツ)_/¯ – Brad Bell Nov 18 '19 at 5:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.