Kladky
Kladky

Reputation: 81

How can I allow only specific users to view specific fields of a content type in Drupal?

I'm setting up a Drupal 7 site where members with the role of "student" are asked to submit reviews about members with the role of "teacher." I need each student to be able to review all the teachers at once, and then I need to build a view where each teacher can only see reviews related to them. The reviews are part of a larger application form, so some fields in the content type need to be viewable to all teachers.

I know how to set up an entity reference view so that students can select teachers from a drop-down. My question is- can I associate a text field with a particular entity? If I could do this, I could configure the teachers' view to only show student feedback fields that were "tagged" with the current user.

To clarify: I can't make a content type that would be filled out multiple times by a student - once for each teacher - because the students need to only create one post. The content type should look something like this:

Pick your first choice teacher: (this is where I've been using an entity reference drop-down)
Explain your first choice: (this should be a text field that only the student, admin, and teacher selected in the first drop-down field have permission to see)

Pick your second choice teacher: (this is another entity reference drop-down)
Explain your second choice: (another text field, visible only the student, admin, and teacher selected in the second drop-down field)

Can I possibly acomplish this with the Rules module?

Upvotes: 3

Views: 1111

Answers (2)

mjimcua
mjimcua

Reputation: 2799

Create a content type "teacher assessment" where each assessment will be related to a teacher. The author of the "teacher assessment" content type would be the student who created this assessment.

You can use the Entity reference module, which has integration support for the Views module.

Upvotes: 1

Muhammad Reda
Muhammad Reda

Reputation: 27023

Try Field Permissions; it's built just for that.

The Field Permissions module allows site administrators to set field-level permissions to edit, view and create fields on any entity.

Upvotes: 4

Related Questions