Answers.Body: <p>Try this:</p>
  
  <pre><code>{# First, grab the username from the URI #}
  {% set username = craft.request.segment(2) %}
  
  {# Then, grab the user based on the username %}
  {% set user = craft.users.username(username).first() %}
  
  {# Make sure we actually found a user #}
  {% if user %}
      {% set blogPosts = craft.entries.section('blog').authorId(user.id).find() %}
  
      Found: {{ blogPosts|length }} blog posts.
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-03T16:32:53.860Z
Answers.Text: Thanks for the reply Brad. The first part is working with a bit of modification `{% set user = craft.users.username(craft.request.segment(2)).first() %}`; `{{ user }}` returns the correct value, however when added to `.relatedTo()` it doesn't return any results (should in this case have 2 entries returned).
Answers.UserDisplayName: Ryan Shrum
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-03T16:35:02.440Z
Answers.Text: Try your 2nd example, then, with a slight modification to field {% set blogPosts = craft.entries.section('blog').relatedTo({ targetElement: user, field: 'authorId' })%}
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-03T16:53:37.183Z
Answers.Text: That didn't work either. I tried a few different iterations of the same line: `{ targetElement: user, field: authorId }` `{ targetElement: user.id, field: authorId }` `{ targetElement: userd, field: 'authorId' }` `{ targetElement: user.id, field: 'authorId' }` You get the idea.
Answers.UserDisplayName: Ryan Shrum
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-03T17:08:57.183Z
Answers.Text: Check the latest edit.  Actually tested this one. :)
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-03T17:12:13.157Z
Answers.Text: Now we're in business! Thanks for that. I guess I'll have to install the Happy Brad plugin now... -sigh-
Answers.UserDisplayName: Ryan Shrum
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-03T17:13:13.403Z
Answers.Text: Only happy when I'm drunk and my current status is sadly, very sober.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-10-31T16:21:58.717Z
Answers.Text: @BradBell is there a way to get around authors not showing up because they are not yet `verified`?
Answers.UserDisplayName: nihiser
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-03T16:23:08.843Z
Answers.LastActivityDate: 2014-07-03T17:06:35.370Z
Answers.LastEditDate: 2014-07-03T17:06:35.370Z
Answers.UserDisplayName: Brad Bell
Body: <p>I'm returning the username as the second segment <code>/blog/username</code> and then setting the <code>username</code> var to <code>craft.request.segment(2)</code>.</p>
  
  <p>I'm looking to list a group of entries by that author (username). I've tried:</p>
  
  <pre><code>{% set blogPosts = craft.entries.section('blog').relatedTo(username) %}
  </code></pre>
  
  <p>I've also tried this:</p>
  
  <pre><code>{% set blogPosts = craft.entries.section('blog').relatedTo({ targetElement: username, field: 'author' })%}
  </code></pre>
  
  <p>Anyone have a way to list through entries related by author?</p>
  
Tags: <entries><users><author>
Title: How do I list entries from a single author?
ThreadText: # How do I list entries from a single author?
  
  (Asked by: username_0 on 2014-07-03)
  
  I'm returning the username as the second segment `/blog/username` and then setting the `username` var to `craft.request.segment(2)`.
  
  I'm looking to list a group of entries by that author (username). I've tried:
  
  ```
  {% set blogPosts = craft.entries.section('blog').relatedTo(username) %}
  
  ```
  
  I've also tried this:
  
  ```
  {% set blogPosts = craft.entries.section('blog').relatedTo({ targetElement: username, field: 'author' })%}
  
  ```
  
  Anyone have a way to list through entries related by author?
  
  **Tags:** entries, users, author
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-07-03. Score: 8 | Accepted answer
  
  Try this:
  
  ```
  {# First, grab the username from the URI #}
  {% set username = craft.request.segment(2) %}
  
  {# Then, grab the user based on the username %}
  {% set user = craft.users.username(username).first() %}
  
  {# Make sure we actually found a user #}
  {% if user %}
      {% set blogPosts = craft.entries.section('blog').authorId(user.id).find() %}
  
      Found: {{ blogPosts|length }} blog posts.
  {% endif %}
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks for the reply username_1. The first part is working with a bit of modification `{% set user = craft.users.username(craft.request.segment(2)).first() %}`; `{{ user }}` returns the correct value, however when added to `.relatedTo()` it doesn't return any results (should in this case have 2 entries returned).  
  > **username_1**: Try your 2nd example, then, with a slight modification to field {% set blogPosts = craft.entries.section('blog').relatedTo({ targetElement: user, field: 'authorId' })%}  
  > **username_0**: That didn't work either. I tried a few different iterations of the same line: `{ targetElement: user, field: authorId }` `{ targetElement: user.id, field: authorId }` `{ targetElement: userd, field: 'authorId' }` `{ targetElement: user.id, field: 'authorId' }` You get the idea.  
  > **username_1**: Check the latest edit.  Actually tested this one. :)  
  > **username_0**: Now we're in business! Thanks for that. I guess I'll have to install the Happy username_1 plugin now... -sigh-  
  > **username_1**: Only happy when I'm drunk and my current status is sadly, very sober.  
  > **username_2**: @username_1 is there a way to get around authors not showing up because they are not yet `verified`?  
  
  ---
  
  