<p>Changed this to be :</p>

<pre><code>{% set userBrands = craft.entries.section('brands').relatedTo(currentUser) %}
{% set fans = craft.users.relatedTo(userBrands) %}

{% for user in fans %}
    &lt;li&gt;{{ user.username }}
{%  endfor %}

{% endblock %}
</code></pre>

CC BY-SA 4.0
2019-05-13T14:49:31.133Z
2019-05-13T14:49:31.133Z
JMKelley
<p>I'm looking to show the users that have an entry relating to the <code>currentUser</code>, it is currently working but is obviously showing duplicates e.g. <code>admin, admin</code> as admin has 2x posts associated. Is there a better way of doing this and removing the duplicates? I just can't think of it.</p>

<pre><code>{% set submissions = craft.entries.section('submissions').relatedTo({
  targetElement: currentUser,
  field: 'submissionBrand',
}) %}

{% for entry in submissions %}
    &lt;li&gt;{{ entry.author.username }}
{%  endfor %}
</code></pre>

<templating>
Show Users who have a related entry
# Show Users who have a related entry

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

I'm looking to show the users that have an entry relating to the currentUser, it is currently working but is obviously showing duplicates e.g. admin, admin as admin has 2x posts associated. Is there a better way of doing this and removing the duplicates? I just can't think of it.
{% set submissions = craft.entries.section('submissions').relatedTo({
  targetElement: currentUser,
  field: 'submissionBrand',
}) %}

{% for entry in submissions %}
    {{ entry.author.username }}
{%  endfor %}

**Tags:** templating


---

## 1 answers

### Answer by username_0 on 2019-05-13. Score: 1

Changed this to be :
{% set userBrands = craft.entries.section('brands').relatedTo(currentUser) %}
{% set fans = craft.users.relatedTo(userBrands) %}

{% for user in fans %}
    {{ user.username }}
{%  endfor %}

{% endblock %}


---

