Jump to content

removing items on admin page


Recommended Posts

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

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.

  • Like 1
Link to comment
Share on other sites

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

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! :rolleyes:

Edited by Joe
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...