0

I created a view that gets the logged in user posts, But I need to alter that view a little bit to only show the posts that has a comment by a different user "not the OP".

Do I have to create a template and add PHP to it? or this can be done with views?

1 Answer 1

1

You don't need to code something here with powerful Views module.

  1. First, add relationship “Comment: Comments of the node” to current View.
  2. Then in “Query settings” check “Distinct” option. Now you have list of nodes which have comments.
  3. Add contextual filter “Comment: Author uid”, set default value to “User ID from logged in user” and don't forget to check option “Exclude” in MORE fieldset.
    enter image description here
    enter image description here

Note that this solution works only for current logged in user.

3
  • I dont think "Then in \“Query settings\” check \“Distinct\” option. Now you have list of nodes which have comments. " is correct. Distinct will just remove duplicate results.
    – saadlulu
    Jul 3, 2012 at 9:58
  • I managed to get only the commented nodes by adding a filter "content: comment count". and gave it a value "equal or greater than" 1
    – saadlulu
    Jul 3, 2012 at 10:00
  • All the steps are interrelated. To set the third step correctly you have to configure (1) and (2).
    – kalabro
    Jul 3, 2012 at 10:06

Your Answer

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

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