Answers.Body: <p>With the <code>all()</code> function at the end of your users-definition you get an array of all users.</p>
  
  <p>The pagination expects a QueryInterface. This is logical: With pagination you <em>do not want</em> to load <em>all</em> users, only the ones listed on the page. </p>
  
  <p>In addition, to paginate, you have to <code>limit()</code> your query to a number of entries.</p>
  
  <p>Therefore: <code>{% set users = craft.users.group('influencer').relatedTo(tag).order('userTotalFollowers asc').limit(10) %}</code> should probably work. </p>
  
  <p>You can find more information and an example in the <a href="https://docs.craftcms.com/v3/dev/tags/paginate.html" rel="nofollow noreferrer">documentation</a>.</p>
  
  <p>I hope this helps and solves the problem.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-02T19:53:11.697Z
Answers.LastActivityDate: 2019-06-03T09:43:47.190Z
Answers.LastEditDate: 2019-06-03T09:43:47.190Z
Answers.UserDisplayName: Luke
Answers.Body: <p>Try modifying the loop to the following: {% for user in pageUsers %}</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-02T19:17:44.227Z
Answers.Text: Hmm, changed it to this, unfortunately, it still error's. I've added the error.
Answers.UserDisplayName: JMKelley
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-07T11:37:29.080Z
Answers.Text: You might still want to change the for loop for pagination to work properly. See here: https://docs.craftcms.com/v3/dev/tags/paginate.html
Answers.UserDisplayName: lpbouvier
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-31T15:16:57.253Z
Answers.LastActivityDate: 2019-05-31T15:16:57.253Z
Answers.UserDisplayName: lpbouvier
Answers.Body: <p>All you need to do is add a limit in your user query. This might help you.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-03T05:05:25.133Z
Answers.LastActivityDate: 2019-06-05T16:44:42.690Z
Answers.LastEditDate: 2019-06-05T16:44:42.690Z
Answers.UserDisplayName: dyanmic Dreamz
Body: <p>I'm looking to paginate my <code>tag</code> page, but unfortuntately it throws a fairly strange error. Remove the pagination -> the page works perfectly? Bit confused, the only thing I think it may be is that it's only returning 1 result so errors?</p>
  
  <pre><code>{% set tag = craft.tags.title(tag).first() %}
  
  {% set users = craft.users.group('influencer').relatedTo(tag).order('userTotalFollowers asc').all() %}
  
  {% if users|length %}
  
  {% paginate users as pageInfo, pageUsers %}
  {% for user in users %}
    {{ user.username }}
  {% endfor %}
  
  
  &lt;div class="row justify-content-between"&gt;
    &lt;div class="col text-left"&gt;
      {% if pageInfo.prevUrl %}&lt;a href="{{ pageInfo.prevUrl }}" class="btn btn-outline-secondary"&gt;← Previous&lt;/a&gt;{% endif %}
    &lt;/div&gt;
    &lt;div class="col text-right"&gt;
      {% if pageInfo.nextUrl %}&lt;a href="{{ pageInfo.nextUrl }}" class="btn btn-outline-secondary"&gt;Next →&lt;/a&gt;{% endif %}
    &lt;/div&gt;
  &lt;/div&gt;
  {% endif %}
  </code></pre>
  
  <blockquote>
    <p>Argument 1 passed to craft\helpers\Template::paginateCriteria() must
    implement interface yii\db\QueryInterface, array given, called in
    /app/storage/runtime/compiled_templates/ef/efb8567b56752c2a98d031bc1d51461f73acc6fdd1f2c8872e44feb2af18359c.php
    on line 133</p>
  </blockquote>
  
Tags: <templating>
Title: Paginate Tag Page
ThreadText: # Paginate Tag Page
  
  (Asked by: username_0 on 2019-05-31)
  
  I'm looking to paginate my `tag` page, but unfortuntately it throws a fairly strange error. Remove the pagination -> the page works perfectly? Bit confused, the only thing I think it may be is that it's only returning 1 result so errors?
  
  ```
  {% set tag = craft.tags.title(tag).first() %}
  
  {% set users = craft.users.group('influencer').relatedTo(tag).order('userTotalFollowers asc').all() %}
  
  {% if users|length %}
  
  {% paginate users as pageInfo, pageUsers %}
  {% for user in users %}
    {{ user.username }}
  {% endfor %}
  
  <div class="row justify-content-between">
    <div class="col text-left">
      {% if pageInfo.prevUrl %}<a href="{{ pageInfo.prevUrl }}" class="btn btn-outline-secondary">← Previous</a>{% endif %}
    </div>
    <div class="col text-right">
      {% if pageInfo.nextUrl %}<a href="{{ pageInfo.nextUrl }}" class="btn btn-outline-secondary">Next →</a>{% endif %}
    </div>
  </div>
  {% endif %}
  
  ```
  
  > Argument 1 passed to craft\helpers\Template::paginateCriteria() must
  > implement interface yii\db\QueryInterface, array given, called in
  > /app/storage/runtime/compiled\_templates/ef/efb8567b56752c2a98d031bc1d51461f73acc6fdd1f2c8872e44feb2af18359c.php
  > on line 133
  
  **Tags:** templating
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2019-06-02. Score: 2 | Accepted answer
  
  With the `all()` function at the end of your users-definition you get an array of all users.
  
  The pagination expects a QueryInterface. This is logical: With pagination you *do not want* to load *all* users, only the ones listed on the page.
  
  In addition, to paginate, you have to `limit()` your query to a number of entries.
  
  Therefore: `{% set users = craft.users.group('influencer').relatedTo(tag).order('userTotalFollowers asc').limit(10) %}` should probably work.
  
  You can find more information and an example in the [documentation](https://docs.craftcms.com/v3/dev/tags/paginate.html).
  
  I hope this helps and solves the problem.
  
  
  ---
  
  ### Answer by username_2 on 2019-05-31. Score: -1
  
  Try modifying the loop to the following: {% for user in pageUsers %}
  
  > **Comments:**
  > **username_0**: Hmm, changed it to this, unfortunately, it still error's. I've added the error.  
  > **username_2**: You might still want to change the for loop for pagination to work properly. See here: https://docs.craftcms.com/v3/dev/tags/paginate.html  
  
  ---
  
  ### Answer by username_3 on 2019-06-03. Score: -2
  
  All you need to do is add a limit in your user query. This might help you.
  
  
  ---
  
  