It would be really useful if you could use the comment author's uid as an argument, that way you could build a tracker view of the nodes that a user has commented on to add to their user profile page that was built in Panels.
It would be really useful if you could use the comment author's uid as an argument, that way you could build a tracker view of the nodes that a user has commented on to add to their user profile page that was built in Panels.
Comments
Comment #1
damienmckennaI've just found one way of doing it..
* Add a relationship for Comment:User and set it to be required.
* Add an argument for User:uid that uses the Comment:User relationship.
Comment #2
dawehnerExact, this is the way to do it. Relationship!
Do you want to write documentation about it?
Comment #3
damienmckennaI'll write a rough blogpost about it, then see what it takes to make it clean for the handbook.
Comment #4
marcushenningsen commentedThanks a lot for posting your solution.
Marcus
Comment #5
dawehnerupdate status.
Any oppinion whether this should be better documented? If yes, create a patch :)
Comment #7
ccshannon commentedThis may work for Comments, but what of Node authors? I can't seem to find a single working solution so that a user can view a page of his own posts, that no one else can see. This used to be a Filter option. But it's not in the D6 version of Views (Views2). I'm stumped.
Comment #8
donquixote commentedThe comment author's uid is stored in the comments table, so it would be natural being able to filter for "comment author uid" without adding a relation.
At the moment there is only a "comment author name" argument (because a copy of the author's username is also stored in the comments table), but no "comment author uid" argument. I think this is weird and should be changed.
Comment #9
dawehnerUse user: uid . It does exactly what you need
Comment #10
donquixote commentedNope, it does not.
user: uid is only available with a relation either to the node or to the comment author (user).
With a relation to the comment node, user: uid becomes "(Node) User: Uid", and it will filter for the node author instead of the comment author.
And the "comment author" relation is what I wanted to avoid, because the comment author uid is already stored in the comments table.
It simply doesn't make sense to me why the comment author name is available as a views argument under "Comment:", but the comment author uid is not. This should be fixed for the sake of a logical world.
Comment #11
dawehnerBut what's the problem of adding the user relationship?
Comment #12
donquixote commentedThe relation would add an unnecessary SQL join, with a (small but avoidable) performance cost.
Usually not much of a problem, but
- if the view is already complex enough in itself, or
- the relevant tables are huge
- the view has to be built in an ajax request, which should be as fast as possible
- a lot of traffic for this view
- a high load on the sql server
- whatever
Adding the user relation is also a (small but avoidable) piece of extra work, and an extra thing to figure out and remember, for a person building a site.
Finally, as said, adding a "Comment: author uid" just makes a lot of sense, and will contribute to a more sane and logical world. Is this not what we all desire?
Comment #13
Letharion commentedPlease don't hijack threads and change the subject. The original question has been answered. Open a new issue for a different question.
Comment #15
donquixote commented@letharion:
Ok, if you promise that noone will mark it as a duplicate of this one..
#996922: Make comment uid,nid available without a relationship
Comment #16
kappaluppa commentedzomg... thank you!!! after HOURS of trying to figure this out, glad I searched one more time and found your solution!