adrianmak Posted September 21, 2016 Share Posted September 21, 2016 I have a site setting page. This page can be edit by a role named "content editor" The setting page has some basic fields like site name, meta keywords and description. There are some other fields like GA code and paypal api access information I want these fields keep away from a content editor role. Only the super admin could able to edit. How could i do that? I'm using pw 2.7.3 Link to comment Share on other sites More sharing options...
FrancisChung Posted September 27, 2016 Share Posted September 27, 2016 If you look at the API Cheatsheet, there's a section for $user. It has several properties of interest to you situation. You should have a look at these and check for user permissions and hide / show those sensitive fields accordingly. $user->rolesGet roles this user has. Returns PageArray. more $user->hasRole($role)Does the user have the given role? Returns true or false.more $user->hasPermission($permission)Does the user have the given permission? Returns true or false. more $user->hasPermission($permission, $page)Does the user have the given permission name on $page? Returns true or false. more Link to comment Share on other sites More sharing options...
adrian Posted September 27, 2016 Share Posted September 27, 2016 What about the Access tab of the field settings 1 Link to comment Share on other sites More sharing options...
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