drupal 7 show/hide field for a role
Asked Answered
P

2

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.

Prosciutto answered 6/9, 2012 at 5:4 Comment(0)
W
10

You should use Field Permissions module.

It's built just for that.

Hope that helps... Muhammad.

Wig answered 6/9, 2012 at 6:22 Comment(1)
+1 upvote and thank you @Muhammad Reda - this helped me and the question asker should have accepted your answer :) Thank you!Testamentary
F
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.

Fennie answered 29/12, 2013 at 22:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.