Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

drupal 7 show/hide field for a role

is there a module to show/hide fields to a specific role in Drupal 7?

I know Field Permissions Module, but it is not exactly what I need.

I have two fields:
picture
picture_premium

and these roles:
anonymous
authenticated premium

the picture field should be visible for: anonymous and authenticated
the picture_premium field shoudl be visible for: premium

note that premium should not see the picture field.

like image 695
lorenzo Avatar asked Sep 06 '12 05:09

lorenzo


2 Answers

You should use Field Permissions module.

It's built just for that.

Hope that helps... Muhammad.

like image 195
Muhammad Reda Avatar answered Oct 23 '22 17:10

Muhammad Reda


To expand on that a bit - in the scenario as described, Field Permissions would not work, as all premium users would also be authenticated. The only way you could use Field Permissions to do this is by assigning a separate role like "regular" to all non-premium authenticated users. Then you could make the picture field visible to anonymous and regular, and picture_premium to premium.

I don't know yet if there is a better solution.

like image 36
brad.bulger Avatar answered Oct 23 '22 16:10

brad.bulger