I created 2 custom fields for a node:

user reference
Integer

I created a couple of pieces of content as an admin and selected a user to reference along with an integer.

I then went to views and created a new node page and a table display and add the following fields:

title
author name
user reference
Integer
post time

I then added the node type filter to just show the what I wanted.

Now I want to only show content from a user reference when the logged in person viewing the page matches the user reference user. So if the author is Sam and the User Reference is Joe, only Joe would be able to see that view because he is logged in as Joe.

I tried selecting the Filter User: Current, but that didn't work. I also tried selecting the argument User: Uid and linked it to the user reference in a relationship, but that didn't work either.

I'm at a loss, does anyone know how I would do this?

Comments

dawehner’s picture

Status: Active » Fixed

Thats possible, sure :)

Add a relationship for the userrefernce. Once you did this you can use every user fields/filters on connection with the userreference.
Then its just adding user: current filter and using the relationship.

waltercat’s picture

Aha! I see I didn't know you could add a relationship to a filter. Thanks!

RedRock2512’s picture

I've got the same issue, but your solution doesn't work for me.

I'm using Views 6.x-2.8 and I can't get this to work. I've created the relationship to Content:User Reference field, but there's no way to use the relationship in User: Current.

Does your solution only work in 6.x-2.x-dev?

RedRock2512’s picture

Whoops. Never mind. I got your solution to work.

One of these days I'll understand Views.

Status: Fixed » Closed (fixed)

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