Jump to content

user role added as class to the body of admin


Martijn Geerts
 Share

Recommended Posts

This would be pretty easy to add to any admin theme:

<body class="<?php foreach($user->roles as $role) echo "role_" . $role->name . " "; ?>">

But whether it's advisable is another question. If you don't want the user to have access to something, it's best that the logic of the page knows not to even display or accept input to it. Otherwise it's a potential security hole. Though for non-security related display adjustments, it seems like a fine way to go. 

Link to comment
Share on other sites

For me it's just to the form-builder and custom settings pages that I want to hide just for normal editors. The Way you describe it now is the way I do it now.

The problem with me is that I update to often & sometimes forget or just overwrite previously set things I changed.

Link to comment
Share on other sites

  • 2 years later...

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
 Share

  • Recently Browsing   0 members

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