Joe Posted February 28, 2014 Share Posted February 28, 2014 For certain views I want to remove some items on the admin page (for non-superusers). For example I have a site settings page (accessible to non-superusers). They should be able to edit all the fields there. But I want to remove the "Children", "Settings" and "Delete" options tabs. So far I have been removing unwanted items in site>templates-admin>default.php, simply replacing them by an empty string or some replacement (<span style="display:none"> etc.). It works, but can be rather tedious, especially when trying to avoid additional validation errors for the admin view. I was wondering if there is a better approach without changing anything in the wire folder... Link to comment Share on other sites More sharing options...
Joss Posted February 28, 2014 Share Posted February 28, 2014 Have you edited the access permissions for the settings page template? You can change whether a particular role can edit, view, create pages based on template or add children. Delete is something you can do globally for the role it self If you need to mix and match permissions, you can add more than one role to any user. So you can set different roles to have different permissions depending on template, the just add those roles to a user as you need. 1 Link to comment Share on other sites More sharing options...
Joe Posted February 28, 2014 Author Share Posted February 28, 2014 Thanks Joss, I will look into that (a little later on today, gotta walk the dog now). Link to comment Share on other sites More sharing options...
Joss Posted February 28, 2014 Share Posted February 28, 2014 Mine has taken one look at the rain and gone under the covers. 2 Link to comment Share on other sites More sharing options...
Joe Posted February 28, 2014 Author Share Posted February 28, 2014 What a big dog! Nice one Well, actually I remember now, I´ve tried the approach you describe before coming up with the idea of string replacement in default.php. I tested again just now. I can create a role which will be the only one that has access to the site settings page and assign this role to a user. I only grant view and edit permissions to that role. That takes care of the delete option. However I can not take the "edit pages" permission away, otherwise the user can not make changes on the site settings page. That leaves the "Settings" tab in place however, leaving the options for renaming or hiding/unpublishing the site settings page. I would also like to remove those, as they will be at least confusing to the user. Link to comment Share on other sites More sharing options...
Joss Posted February 28, 2014 Share Posted February 28, 2014 Er, not sure how to do this, but as a work around you could use a bit of jquery to insert a hide this tab class if the user has a certain role. That would work a little more generally, perhaps. But feels messy Link to comment Share on other sites More sharing options...
adrian Posted February 28, 2014 Share Posted February 28, 2014 A couple of options from Soma for achieving this: http://processwire.com/talk/topic/3159-hide-settings-tab-in-page-edition/?p=31126 http://processwire.com/talk/topic/4680-block-access-to-settings-delete-and-view-tabs-for-page/?p=45734 2 Link to comment Share on other sites More sharing options...
Soma Posted February 28, 2014 Share Posted February 28, 2014 Thanks adrian, so I don't have to take care once again. Looks like it got through... Link to comment Share on other sites More sharing options...
Joe Posted February 28, 2014 Author Share Posted February 28, 2014 (edited) Thank you adrian! ...a bit embarrassing, as one of the threads was started by me. I will see if I get my head around it this time, now that I know PW a little better than back then, when I´d just started with it. I then came up with the other solution (just replacing certain parts of the content string in default.php, but it has always felt like a hack). Well yes, thanks, Soma. @Joss: that kind of seems similar to what I´ve been doing. Works, but feels kind of hacky;-) Thanks. So I did it the way Soma describes, with a modified helloworld.module. Yes, that´s easy, it just hadn´t appeared as such an obvious way to go about it to me at first. Now the code in my default.php looks much cleaner. Thanks again everyone! Edited March 2, 2014 by Joe 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