tires Posted October 19, 2022 Posted October 19, 2022 HI! I would like to show some fields (checkboxes) in the user profile depending on the role of the user. I.e. If the user has the role "checker 1" the first check box i shown when he is editing his profile. If the user has the role "checker 2" the second check box i shown in his profile. BTW. I am using the LoginRegister module for users to edit they profile if this makes a difference.
3fingers Posted October 19, 2022 Posted October 19, 2022 A combination of this module and the right selector: $user->hasRole($role) should do the trick ;) 1
tires Posted October 19, 2022 Author Posted October 19, 2022 Thank you! While trying to implement your solution I found an even easier way. I restricted the access in the field settings to specific roles. This works pretty well!
tires Posted October 19, 2022 Author Posted October 19, 2022 To allow the user to check the box, I need to give the role permission to view and edit the field. I also apparently need to give the role page editing permission ...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now