Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By scotthoff on
I have set up a node type that has a mandatory user reference.
I was able to create a view to display the fields on that node (I am using CCK).
I want to filter based on the user that is currently logged in. That is, show the nodes that have the user reference equal to the currently logged in user.
The problem is, it seems that that the view builder expects me to choose from a drop down of users. I want the filter to occur dynamically.
Any experts out there?
Comments
Add a Relationship
Click the "+" symbol in "Relationships" to add a new one.
Choose "Content: <your user field's name>"
Click "Require" and then "Update"
You've just added a new Relationship.
Now, add a new Filter.
Choose "User: Current"
The next screen now shows a "Relationship" drop-down box. Choose the one you created above and and click "Yes" for "Is the logged in user" and click "update"
Your view will now filter based on the current user.
---------------------------------
Steven Wright
Slalom
Re:
I'm trying to get this to work. I put in some time but have not had success yet. Thanks for the help. I will keep you posted.
Works
Had the same problem. @stevenc Your solution worked. Legendary.
I'm sorry I never replied
I'm sorry I never replied pointing out that your response was helpful.
I wish you my belated thanks.
Very welcome
Glad it worked out! =)
---------------------------------
Steven Wright
Slalom
It works for me
Thank you very much stevenc. I was searching for 2 days and at last with your guidance I solved this issue.
Thans
Worked for me. Thanks a lot.
Worked for me by adding
Worked for me by adding "Argument", not "Filter".
Thanks a lot.
Thanks so much :)
Thanks so much :)
Thanks a lot stevenc.
Thanks a lot stevenc.
Thanks a lot Steven
After 7 years i used same technique and it is working for me also.
Thanks a lot Steven !!!!!
it's helped me
@stevenc thanks
Thanks
Thank you, Steven! It works perfectly!
Works in Drupal 8 as well
Just a note that I applied this basic technique to Drupal 8 successfully. Thanks.
@stevenc solution are awesome
@stevenc solution are awesome!