Answers.Body: <p>Try this:</p>
  <pre><code>{% set entries = craft.entries.section('movementCoursesEntries').level(1).relatedTo({
     targetElement: currentUser,
     field: 'permittedUsers'
  }).ids() | join(', not ') %}
  
  {% set unrelated = craft.entries.section('movementCoursesEntries').level(1).id('and, not '~entries).all() %}
  
  {% for entry in unrelated %}
      {{ entry.title }}
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-03T11:05:05.537Z
Answers.Text: Thank you! Works like a charm!
Answers.UserDisplayName: LessMore Creative Studio
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-03T12:19:51.780Z
Answers.Text: @LessandMoreCollective Glad to help you!
Answers.UserDisplayName: Pavel Pavlovich
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-03T07:47:59.993Z
Answers.LastActivityDate: 2020-08-03T07:47:59.993Z
Answers.UserDisplayName: Pavel Pavlovich
Body: <p>I am trying to get all the entries that don't related to the current user via a user field.
  <br>
  I have used the following code to fetch all the entries that do related to the current user
  <br></p>
  <pre><code>{% set entries = craft.entries.section('movementCoursesEntries').level(1).relatedTo({
     targetElement: currentUser,
     field: 'permittedUsers'
  }).find() %} 
  </code></pre>
  <p>When I try to exclude these entries from the rest of the entries in the structure, I get nothing</p>
  <pre><code>{% set unrelated = craft.entries.section('movementCoursesEntries').level(1)|without(entries) %}
  
  {% for entry in unrelated %}
      {{ entry.title }}
  {% endfor %}
  </code></pre>
  <p>Any idea how to filter those entries properly?
  Thank you!</p>
  
Tags: <relations><current-user><exclude>
Title: Get entries that aren't related to current user
ThreadText: # Get entries that aren't related to current user
  
  (Asked by: username_0 on 2020-08-02)
  
  I am trying to get all the entries that don't related to the current user via a user field.
    
  I have used the following code to fetch all the entries that do related to the current user
  
  ```
  {% set entries = craft.entries.section('movementCoursesEntries').level(1).relatedTo({
     targetElement: currentUser,
     field: 'permittedUsers'
  }).find() %} 
  
  ```
  
  When I try to exclude these entries from the rest of the entries in the structure, I get nothing
  
  ```
  {% set unrelated = craft.entries.section('movementCoursesEntries').level(1)|without(entries) %}
  
  {% for entry in unrelated %}
      {{ entry.title }}
  {% endfor %}
  
  ```
  
  Any idea how to filter those entries properly?
  Thank you!
  
  **Tags:** relations, current-user, exclude
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-08-03. Score: 0 | Accepted answer
  
  Try this:
  
  ```
  {% set entries = craft.entries.section('movementCoursesEntries').level(1).relatedTo({
     targetElement: currentUser,
     field: 'permittedUsers'
  }).ids() | join(', not ') %}
  
  {% set unrelated = craft.entries.section('movementCoursesEntries').level(1).id('and, not '~entries).all() %}
  
  {% for entry in unrelated %}
      {{ entry.title }}
  {% endfor %}
  
  ```
  
  > **Comments:**
  > **username_0**: Thank you! Works like a charm!  
  > **username_1**: @LessandMoreCollective Glad to help you!  
  
  ---
  
  