How to show all nodes and comments by a user in a single view? I am using Drupal 8 in combination with the Forum module, and I'd like to show all comments and nodes by a user on his profile page, in a single view.

I can't find a way to get this to work, because they are different entity types.

I've tried using two relationships, but that only gives me rows with each comment linked to each node.

Is this at all possible?

EDIT: This is an example of the result that I'm trying to achieve:


Comment 5
Comment 4
Node 2
Comment 3
Node 1
Comment 2
Comment 1
This is an example of my setup, just switch out article or content type for your content type or forum posts.

node--article--teaser.html.twig:

&lt;div class="{{ node.type.0.target_id | clean_class }}-teaser-wrapper" {{ attributes }}&gt;

    {# other fields #}

    {{ content.field_comments }}

&lt;/div&gt;


or:

&lt;div class="{{ node.type.0.target_id | clean_class }}-teaser-wrapper" {{ attributes }}&gt;

    {{ content }}

&lt;/div&gt;


As long as the comment field is set to display in your teaser view mode, and printed via your template, the comments will show in the view results.

View Config:



The contextual filter is the important part.





This setup uses content format teaser, the alternative would be using fields. Both will work, with fields you may need a relationship to comments depending on what fields you need available in your view.