Limit drupal view show only nodes created by user

I use drupal 7. I created a view to display nodes of a certain type of content (for example, products). When viewing the page, I want to show only those products that were created by the user (currently all products are displayed).

I would like to do this without using the url filter, so url will be simple:

/ myproducts

+7
source share
3 answers

Use the filter "User: current". If that doesn't work, try with an attitude

+12
source

In the extended help module, you can see "Example of filtering content by the current user in the system": http: // yoursite / help / views / example-filter-by-current-user

And it says there:

Relationship Creation

In order to have access to a content author, it is important to create a relationship between the current type of content and users.

In the "Advanced" section in the right column, select "Add" next to "Relations."

Select "Content: Author" and click "Add and Configure Relationships." Leave the settings as they are, and click Apply (all displays).

You now have access to user data related to viewing content.

View filtering

Now you need to filter the view to display only content created by the current user. This> data is now available for content because you created the link in step> above.

Next to the filter criteria, click Add to add a new filter to your view.

Filter the list of fields by selecting "User" next to "Filter" at the top. You now have more fields than before because of the relationships you created.

Select a user: the current one from the list and click "Add" and configure the filter criteria.

Since this field is visible only because of the relationship you created, the author will already be selected in the "Communication" section. This shows that the relation you created is used for the filter field.

Select "Yes" in the "Login" section and click "Apply" (all displays).

If you have authoring content such as "Blog Post", you should see a list of these posts in the preview section below.

Saving and testing views

+7
source

Here is what I used to make it work.

  • Within the relationship, add the content: author
  • In the context of contextual relationships, add the user: name and authentication relationship: author (or what you called your relationship).

And if you want to be more confident, add a filter: user current and add a link.

+2
source

All Articles