I am trying to eager load users in a specific group to reduce queries. I've tried this:
{% set designers = craft.users({
group: 'designers',
with: [
'userAgencyName',
'userAgencyUrl',
'userFreelancerAgency',
'userDescriptionServices',
'userBudget',
'userCity',
'userStateProvince'
]
}) %}
This consists of 5 user text fields and 2 user category fields. Although it's returning the array to string conversion error.
The loop is setup like this:
{% paginate designers.limit(7) as designers %}
{# Loop through Designers #}
{% for designer in designers %}
<div class="listing-box">
<h1><a href="/designers/{{ designer.username }}">{{ designer.userAgencyName }}</a></h1>
<div class="listing-links">
<ul>
<li>
{% for category in designer.userFreelancerAgency %}
<a href="{{ category.url }}"> {{ category }}</a>
{% endfor %}
</li>
{% for category in designer.userBudget %}
{% if category %}
<li>
Budgets: <a href="{{ category.url }}">{{ category }}</a>
</li>
{% endif %}
{% endfor %}
{% if designer.userCity | length %}
<li>{{ designer.userCity }}, {{ designer.userStateProvince }}</li>
{% endif %}
</ul>
</div>
<p>{% if designer.userDescriptionServices %}{{ designer.userDescriptionServices }}{% endif %}
</div>
<!--End listing-box-->
{% endfor %}
Thanks in advance for any help you can give!
withand then reload template. – mcclaskiem Apr 07 '16 at 19:47