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

damienmckenna’s picture

I'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.

dawehner’s picture

Exact, this is the way to do it. Relationship!

Do you want to write documentation about it?

damienmckenna’s picture

I'll write a rough blogpost about it, then see what it takes to make it clean for the handbook.

marcushenningsen’s picture

Thanks a lot for posting your solution.

Marcus

dawehner’s picture

Status: Active » Fixed

update status.

Any oppinion whether this should be better documented? If yes, create a patch :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ccshannon’s picture

This 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.

donquixote’s picture

Status: Closed (fixed) » Active

The 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.

dawehner’s picture

Status: Active » Fixed

Use user: uid . It does exactly what you need

donquixote’s picture

Status: Fixed » Active

Nope, 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.

dawehner’s picture

user: uid is only available with a relation either to the node or to the comment author (user).

But what's the problem of adding the user relationship?

donquixote’s picture

The 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?

Letharion’s picture

Category: feature » support
Status: Active » Fixed

Please don't hijack threads and change the subject. The original question has been answered. Open a new issue for a different question.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

donquixote’s picture

@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

kappaluppa’s picture

zomg... thank you!!! after HOURS of trying to figure this out, glad I searched one more time and found your solution!