2

For my website, I have a view (created using the Views module), let's call it View1, that displays content types that have field of user entity references (as in, it's a select list with all the users for the website on there).

I have a separate view (Views module), let's call it View2, that is used by non-admin users. I would like that view to be populated by content types that have been assigned to them by the admin. The admin uses the select list mentioned above to assign users to a certain user.

Is there a way to filter content types in View2 so that it only displays content that has been assigned to you from View1?

0
1

You can just create non-admin view which display all given content types, then users can see specific content types based on their role permissions. This can be achieved by adding Nodeaccess.

For example:

  • user1 has role ct1
  • user2 has role ct2
  • assign view permission Nodeaccess:

    • ct1 role can view ct1 type, but not ct2
    • ct2 role can view ct2 type, but not ct1
    • to extend the access using field references, try: Node access node reference,
  • create a view which lists ct1 & ct2 and users will see the right content based on their roles.

You other few options to investigate:

  • in your non-admin view configure relationships, so field can point to the right content type (also check: Bundle Name Reference + EVA)
  • in your users's View, create sub-views where you can override the fields (if your Style is set to Fields),
  • create multiple views for each content type and implement Viewfield, so admin can assign the view based on the its value,
  • create a non-admin view with rendered entity Style, create a template, write a logic in preprocess function and assign to the template variable.
4
  • Sorry I didn't make this clear in the original post, but both user1 and user2 are supposed to have the same role.
    – theK_S
    Dec 28 '15 at 21:40
  • @KevinSang They could still share the same role, but for permission configuration, you can have separate one.
    – kenorb
    Dec 28 '15 at 21:43
  • the thing is, the users are both accessing the same content type, its just that this specific instance has been assigned to one user and this instance has been assigned to another. Is it still possible to implement something like this using nodeaccess?
    – theK_S
    Dec 29 '15 at 19:46
  • Give a try and see how it goes. nodeaccess module is quiet advanced so I think you should be able to do it. If you mean field references, try to extend it by: nodeaccess_nodereference
    – kenorb
    Jan 5 '16 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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