6

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.

Muhammad Reda
  • 26,379
  • 14
  • 93
  • 105
lorenzo
  • 187
  • 2
  • 8

2 Answers2

10

You should use Field Permissions module.

It's built just for that.

Hope that helps... Muhammad.

Muhammad Reda
  • 26,379
  • 14
  • 93
  • 105
  • 1
    +1 upvote and thank you @Muhammad Reda - this helped me and the question asker should have accepted your answer :) Thank you! – therobyouknow Jun 11 '13 at 18:53
2

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.