How do I display data from an entry field related to each user in a user listing page? I am displaying a list of users with entries in the Design section using a Route. I am using this code for that and it seems to be working to display the correct users:

{# Grab all the Design Entries #}
{% set designs = craft.entries.section('designs').find() %}

{# Group by the authorId #}
{% set entriesByAuthor = designs|group('authorId') %}

{# Grab all of the users with the userIds in entriesByAuthor #}
{% set designers = craft.users.id(entriesByAuthor|keys).group('members') %}


Although the issues I am having is trying to display data from fields from the entries by these users. For example, entries in the Design section also have images associated with them. I am trying to display the first image from the 'screenshots' field from the Designs section:

{% for assets in designers %}
    {% for image in assets.screenshots %}

        {% if image %}
            &lt;a href="{{ user.userAgencyUrl }}"&gt;&lt;img src="{{ image.url }}" border="0" /&gt;&lt;/a&gt;
        {% endif %}         

    {% endfor %}
{% endfor %}


This does not give an error, but does not display anything for the image. I also tried adding .first() to this to get the first image from each entry, but that resulted in an error.

Any help will be appreciated! I have searched thoroughly for information about displaying entry fields from a user list (instead of just user fields) and I have not been able to find this information. (I also tried several other methods, such as relatedTo.)

Thanks!
You already have the right array of Design Entries grouped by your Designer's user IDs with this line: 

{% set entriesByAuthor = designs|group('authorId') %}


Now all you have to do is to loop through this entriesByAuthor array. Use this syntax to iterate over Keys and Values:

{% for key, value in entriesByAuthor %}
    {{ key }}: {{ value }}
{% endfor %}


Within the loop key is the authorId you grouped by and value is an array of EntryModels that share the same value for the authorId property. To list the Design entries you have to nest another for-loop and iterate over that array of EntryModels.

To retrieve other Designer data besides the ID you first need to grab the UserModel. Create a new ElementCriteriaModel with the authorId as a parameter and use the first() function to get the model.

{# Grab all the Design Entries #}
{% set allDesigns = craft.entries.section('designs').limit(null).find() %}

{# Group by the authorId #}
{% set allDesignsByAuthor = allDesigns|group('authorId') %}

{# Loop through all Design Entries grouped by the authorId #}
{% for authorId, designsByAuthor in allDesignsByAuthor %}

    {# Grab the Designer's UserModel #}
    {% set designer = craft.users.id(authorId).first() %}

    &lt;h2&gt;{{ designer.name }}&lt;/h2&gt;

    {# List the Designer's Design Entries #}
    {% for design in designsByAuthor %}

        &lt;h3&gt;{{ design.title }}&lt;/h3&gt;

        {# List the Screenshots #}
        {% for image in design.screenshots %}

            &lt;a href="{{ designer.userAgencyUrl }}"&gt;
                &lt;img src="{{ image.url }}" alt="{{ image.title }}" /&gt;
            &lt;/a&gt;

        {% endfor %}

    {% endfor %}

{% endfor %}


.

Edit:

Only now I got it, why you did this line to grab the UserModels with an ID of allDesignsByAuthorId|keys. This is in fact a good idea if you want list the users in another sort order than the user ID. Because I don't think you can do that with the approach I posted above.

Here's how you proceed after you fetched the Designers with a sort order of your desire. Loop through the array of Designers and create a new ElementCriteriaModel for each designer to grab the Designs using the Designer's user ID as the value for the authorId property.

{# Grab all the Design Entries #}
{% set allDesigns = craft.entries.section('designs').limit(null).find() %}

{# Group by the authorId #}
{% set allDesignsByAuthorId = allDesigns|group('authorId') %}

{# Grab all of the users with the userIds in allDesignsByAuthorId #}
{% set designers = craft.users.id(allDesignsByAuthorId|keys).order('lastName') %}

{# Loop through the array of Designers #}
{% for designer in designers %}

    &lt;h2&gt;{{ designer.name }}&lt;/h2&gt;

    {# Grab all of the Design Entries created by this Designer #}
    {% set designs = craft.entries.section('designs').authorId(designer.id).find() %}

    {# List the entries #}
    {% for design in designs %}

        &lt;h3&gt;{{ design.title }}&lt;/h3&gt;

        {# List the Screenshots #}
        {% for image in design.screenshots %}

            &lt;a href="{{ designer.userAgencyUrl }}"&gt;
                &lt;img src="{{ image.url }}" alt="{{ image.title }}" /&gt;
            &lt;/a&gt;

        {% endfor %}

    {% endfor %}

{% endfor %}


.

2nd Edit:

You only need to show one image for each Designer? Do it like so:

{# Grab all the Design Entries #}
{% set allDesigns = craft.entries.section('designs').limit(null).find() %}

{# Group by the authorId #}
{% set allDesignsByAuthorId = allDesigns|group('authorId') %}

{# Grab all of the users with the userIds in allDesignsByAuthorId #}
{% set designers = craft.users.id(allDesignsByAuthorId|keys).order('lastName') %}

{# Loop through the array of Designers #}
{% for designer in designers %}

    {# Get the total number of Design Entries created by this Designer #}
    {% set totalDesigns = craft.entries.section('designs').authorId(designer.id).total() %}

    {# Grab the latest Design Entry created by this Designer #}
    {% set design = craft.entries.section('designs').authorId(designer.id).first() %}

    {# Grab the first screenshot image of that entry #}
    {% set image = design.screenshots.first() %}

    {# Output #}
    &lt;h2&gt;{{ designer.name }}&lt;/h2&gt;

    &lt;p&gt;{{ totalDesigns }}&lt;/p&gt;

    &lt;a href="{{ designer.userAgencyUrl }}"&gt;
        &lt;img src="{{ image.url }}" alt="{{ image.title }}" /&gt;
    &lt;/a&gt;

{% endfor %}