Community

View content based on user referenced on page? [SOLVED]

What I what to be able to do is create a view that will display a content type (a blog for instance) created by a user that is referenced on a page. In other words: I want one view block that will change it's output depending on the user referenced on the page it is on...is this even possible?

Comments

By "the user referenced on

By "the user referenced on the page" do you mean the author of the node/content or something else?

I mean a User reference field

I mean a "User reference field" that I added to the node.

Saving the internet, one file at a time.
If I helped, Pay it forward or give me a cookie ;)

I would try this First make a

I would try this

First make a view that takes a content:nid (node:nid) as a contextual argument, configure so it takes the default argument from the URL. At this point you have a view that can lists nodes from the current node.

Now add a relationship on the "User reference field", this should let you view user information about the user.

Now add a relationship on "User: Content authored" (should use the previous relationship), this will get you back to content. You can then add fields, filter criteria and sort order that used this relationship.

There is no relationship on

There is no relationship on "User: content authored" maybe cause I'm only using views 2.16?

Saving the internet, one file at a time.
If I helped, Pay it forward or give me a cookie ;)

Sorry, my reply was for

Sorry, my reply was for Drupal 7 and views 3.

The user relationship is implied in views 2, I am not sure though there is a relation to go from user to content though.

Thanks anyways, I'll keep

Thanks anyways, I'll keep looking.

Saving the internet, one file at a time.
If I helped, Pay it forward or give me a cookie ;)

This:

This: http://geeksandgod.com/tutorials/computers/cms/drupal/limit-views-create... helped me out a lot! Although I can't use a reference field like I had hoped, I can change the author of the node (a small price to pay for functionality)!

here's how to do it:

  1. Edit the view in question (Administer > Site building > Views and click "Edit" for that view).
  2. Select the particular Block display you want to edit (or edit the default if there are only Block displays and you want it to apply to all of them).
  3. Click the + next to Arguments to add a new argument. Limit to User under the drop-down and tick/check User:Uid. (You might think that User: Name is what you want here, especially as the comment text says "The user or author name" but no, that doesn't seem to serve our purposes here.)
  4. Click "Add".
  5. Fear not! You can ignore most of what you are presented with here. Look at "Action to take if argument is not present:" The option you want—bizarrely named as it is, is "Provide default argument". Click that to select it.
  6. You are then presented with additional options that to me seem somewhat surprising for a "default argument"... Select here "User ID from URL", and more importantly then tick the further option that appears: "Also look for a node and use the node author". Congratulations, you've found the secret hidden passageways to the control you require!
  7. Click "Update" at the bottom of all these options.
  8. Click "Save", which is no longer greyed out now you have made a change with your "Update".

Saving the internet, one file at a time.
If I helped, Pay it forward or give me a cookie ;)

nobody click here