<p>Assuming this is in Craft 3, you should be using <code>.orderBy()</code> instead of <code>.order()</code>. Does the following work as expected?</p>

<pre><code>{% set users = craft.users.group('influencer').orderBy('score desc').limit(24) %}

{% paginate users as pageInfo, pageUsers %}

{% for user in pageUsers %}
    {{ user.username }} : {{ user.score }} &lt;br&gt;
{% endfor %}
</code></pre>

<p>Here it is in the docs: <a href="https://docs.craftcms.com/v3/dev/element-queries/user-queries.html#orderby" rel="nofollow noreferrer">https://docs.craftcms.com/v3/dev/element-queries/user-queries.html#orderby</a></p>

<p>Also turn on <code>devMode</code> to be sure that no errors are being suppressed.</p>

CC BY-SA 4.0
2019-05-22T21:59:25.160Z
I need to limit the array for Pagination to work, I've edited my answer with code but it's still not ordering them correctly.
JMKelley
CC BY-SA 4.0
2019-05-23T06:51:09.610Z
How exactly is it ordering them? I just did a local test and this appears to be working.
Ben Croker
CC BY-SA 4.0
2019-05-23T10:47:23.033Z
Alphabetically for some reason? Could it be empty values?
JMKelley
CC BY-SA 4.0
2019-05-23T14:06:50.840Z
Well do any users actually have values store in their `score` field?
Ben Croker
CC BY-SA 4.0
2019-05-23T14:11:31.620Z
Heh, yeah. 3 out of 5 entries have a user.score
JMKelley
CC BY-SA 4.0
2019-05-23T20:09:52.520Z
Then I don't see why it wouldn't work :)
Ben Croker
CC BY-SA 4.0
2019-05-24T08:43:41.983Z
This is so bizarre!
JMKelley
CC BY-SA 4.0
2019-05-24T12:09:21.730Z
My advice would be to test it with entries with the template scaled down to the bare minimum, then troubleshoot from there.
Ben Croker
CC BY-SA 4.0
2019-05-24T12:10:18.607Z
Could it be that the output is being cached? Does changing the limit make a difference?
Ben Croker
CC BY-SA 4.0
2019-05-30T11:27:48.017Z
nope, even changing the field that it's sorting on makes little difference. I think this is a bug?
JMKelley
CC BY-SA 4.0
2019-05-30T11:35:02.097Z
Think I figured this out - whole numbers work - decimal point numbers, fail.
JMKelley
CC BY-SA 4.0
2019-05-22T20:17:32.733Z
2019-05-23T06:50:25.627Z
2019-05-23T06:50:25.627Z
Ben Croker
<p>I'm trying to order my entries by a numeric custom field named <code>score</code>, some of these values can be <code>0</code> but unfortunately, it's not getting ordered at all?</p>

<pre><code>{% set users = craft.users.group('influencer').order('score').limit(24) %}

{% if users|length %}
    {% paginate users as pageInfo, pageEntries %}
    {% for user in pageEntries %}
</code></pre>

<p>/* New Code */</p>

<pre><code>  {% set users = craft.users.group('influencer').orderBy('score desc').limit(24) %}

          {% if users|length %}

          {% paginate users as pageInfo, pageEntries %}
          {% for user in pageEntries %}
</code></pre>

<templating>
Order by Numeric Custom Field Value
# Order by Numeric Custom Field Value

(Asked by: username_0 on 2019-05-22)

I'm trying to order my entries by a numeric custom field named score, some of these values can be 0 but unfortunately, it's not getting ordered at all?
{% set users = craft.users.group('influencer').order('score').limit(24) %}

{% if users|length %}
    {% paginate users as pageInfo, pageEntries %}
    {% for user in pageEntries %}

/* New Code */
  {% set users = craft.users.group('influencer').orderBy('score desc').limit(24) %}

          {% if users|length %}

          {% paginate users as pageInfo, pageEntries %}
          {% for user in pageEntries %}

**Tags:** templating

---

## 1 answers

### Answer by username_1 on 2019-05-22. Score: 3 | Accepted answer

Assuming this is in Craft 3, you should be using .orderBy() instead of .order(). Does the following work as expected?
{% set users = craft.users.group('influencer').orderBy('score desc').limit(24) %}

{% paginate users as pageInfo, pageUsers %}

{% for user in pageUsers %}
    {{ user.username }} : {{ user.score }} 
{% endfor %}

Here it is in the docs: https://docs.craftcms.com/v3/dev/element-queries/user-queries.html#orderby
Also turn on devMode to be sure that no errors are being suppressed.

> **Comments:**
> **username_0**: I need to limit the array for Pagination to work, I've edited my answer with code but it's still not ordering them correctly.  
> **username_1**: How exactly is it ordering them? I just did a local test and this appears to be working.  
> **username_0**: Alphabetically for some reason? Could it be empty values?  
> **username_1**: Well do any users actually have values store in their `score` field?  
> **username_0**: Heh, yeah. 3 out of 5 entries have a user.score  
> **username_1**: Then I don't see why it wouldn't work :)  
> **username_0**: This is so bizarre!  
> **username_1**: My advice would be to test it with entries with the template scaled down to the bare minimum, then troubleshoot from there.  
> **username_1**: Could it be that the output is being cached? Does changing the limit make a difference?  
> **username_0**: nope, even changing the field that it's sorting on makes little difference. I think this is a bug?  
> **username_0**: Think I figured this out - whole numbers work - decimal point numbers, fail.  

---

