2

Is there a way to allow only a node author as well as an author referenced by a node reference field to view the node and comments.

Example:

A listing content type. (for posting want ads) An Offer content type. (for making an offer for referenced listing ad)

Listing has: Title, pics, description, location, etc... as fields' Offer has: Title, Listing Node Reference, Message, Offered price, etc... as fields

I want to hide the offer nodes (in any view mode) from everyone but admins, the offer node author and the listing node author.

Basically, creating a simple private messaging system. with nodes as messages and comments as replies to the message that only those two accounts can see as well as admins.

Any suggestions on the best way to implement this? Thank you.

1

You could use Node Access User Reference for this task:

Gives content access permissions to users for content that references the users with User reference or Entity reference.

This is great if you want your content authors to be able to choose additional authors, or choose who can view their content, as well as being able to display the list of authors or viewers within your content, or in views displays.

Or you could use OG groups for something like this as well: https://www.drupal.org/project/og It may be a little harder to setup at first but certainly more a more flexible option.

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.