I have two content types, provider and products.

The providers is a list of titles filtered by logged in user (each user can only see the providers he enterd). By clicking the provider the user is taken to a page that contains a table with all the provider products.

the provider and the products content type are linked via a unite content field using contextual filter (the mutual field called lpid).

In the products page the path is provider/%/products while the wildcard represents the lpid field.

Everything works great, what I am trying to do is to prevent from users to see other users content.

Is there a way to pass the wildcard via $_POST so the user will not be able manualy change the url?


1 Answer 1


"Allow users to see own content only", You can achieve this using contextual filter and relationships in advance settings in views module, Given by you already set the contextual filter set filter to login user,

1.) In Advanced settings add field Content:author in relationships.

2.) Then in Contextual Filters add User: Uid and choose provide default value and set Provide default value Type User ID from logged in user.

enter image description here

enter image description here

  • Hey, Thank you for your detailed answer, I did what you suggested in the provider content type, what I was asking is if there is a way to show the products items to the users who inserted the provider. for example: one of my provider is shoes store. the id of the shoes store is 227 in that provider i have products, the products are inserted by an external form and inserted as products content type items. now, when i click the shoes store i am redirected to provider/227/products there i see all the products related. the problem is that if I write a different id in the...
    – DavSev
    Commented Aug 17, 2016 at 12:01
  • ...URL let's say 228 i wiil see all the products belong to the 228 provider which was created by other user. is there a way to prevent that? lets say pass the id variable in $_POST method?
    – DavSev
    Commented Aug 17, 2016 at 12:01
  • can you provide current settings of your views so that I can use that as a reference? I will update my answer base on your current settings
    – iamroald
    Commented Aug 17, 2016 at 12:12
  • also the id of the provider is that the user id of the provider?
    – iamroald
    Commented Aug 17, 2016 at 12:15
    – DavSev
    Commented Aug 17, 2016 at 12:16

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.