0

I have a views block that lists a user's comments on the site.

For example user JohnA has posted 5 comments total on the site like so:

  • Node 1: 2 comments
  • Node 2: 1 comment
  • Node 3: 2 comments

In my view, I want to create a list of nodes that JohnA has commented on with the following Format:

<h1>Node Title</h1>
<p>By Node Author</p>
<p>You commented on this 2 months ago</p>

However, when a create a view and add the field Comment: Post Date, Node 1 and Node 3, which JohnA has commented on twice, show up twice (because JohnA has two values for that field in this context).

The view works fine until adding any comment specific field, such as comment post date, comment body, etc...

I'm thinking about using the Views View Field module as a potential solution. I feel like there is a simple solution that I am missing.

Any help would be greatly appreciated.

1 Answer 1

1

I would use the Views Field View or a similar module for this.

The reasons is that you are trying to filter on two things: * Most recent comment * Unique node

I would create a "parent" view that shows all nodes the user has commented on and then a "child" view that filters the comments on each node to show the most recent one.

See my detailed answer here to a question about getting the latest node per user.

An alternative is to play around with Views aggregation settings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.