0

I come here because i want to create a view who display all content of type "Document" of my website, but by default i want to show the content of type "Document" of the user connected. And after when i click on the button reset of the view, i want to see all content of type "Document" of all users.

For example the view when i come on the page :

Me | document 1
Me | document 3
Me | document 4
Me | document 6

When i reset the view :

Me | document 1
Jean | document 2
Me | document 3
Me | document 4
Jean | document 5
Me | document 6
Mickael | document 7

this is possible ?

Thanks

1 Answer 1

0

This is possible. What you want to look into here is the concept of Views Contextual Filters. So you'll set this up something like this:

Contextual Filters

This will allow you to have a default view that works on the currently logged in user. Then you can setup another Exposed Filter which shows all authors. Hope this helps.

Thanks to this somewhat related post for the image.

4
  • thanks for that image it works ! by default i have my view filtered by user connected. but when i reset the view, the contextual filter stay and i see the nodes by author. How can i remove a contextual filter on reset ?
    – Cracs
    Commented Dec 24, 2014 at 10:12
  • This is where things get a little more tricky because you're already using the default value. So you have 2 options:Have two displays of the same view. One that shows filtered by author and one that is all posts. Then simply add a link in the Header portion of the view to "Show All" which would bounce people to the other view. Similarly show a link on the author filtered view
    – webkenny
    Commented Dec 24, 2014 at 12:38
  • oh ok. i tried to pass the id of user in the url like : mydocument/150, it works i got thedocument by user 150 and to display the document of all user i put a button in the header without id user in url like : mydocument . i think it's the best solution... Because the reset button doesn't remove the id user in url...
    – Cracs
    Commented Dec 24, 2014 at 12:52
  • Awesome! Sometimes Drupal is just thinking a little out of the box. :) If this helped you don't forget to mark the answer accepted and good luck with your site!
    – webkenny
    Commented Dec 24, 2014 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.