Sometimes you want your users to have access to a Content Type, but not have the ability to change things (for example, the Host or Folder field).
You can use a Custom Field to redact that particular field, and you can base that field on role.
Here’s an example:
#if (!$cmsuser.isCMSAdmin($user))
-script-
document.getElementById(‘HostSelector’).style.display=“none”;
document.getElementById(‘hidehost_tag’).style.display=“none”;
document.getElementById(‘host1_tag’).style.display=“none”;
-script-
#end
Here’s another little trick, you can hide a Tab, like the Advanced Tab. This way you can just throw all the stuff you don’t want the editors to see on one tab and not write code for each:
#if (!$cmsuser.isCMSAdmin($user))
-script-
window.addEventListener(‘load’, function() {
dtabs=document.getElementById(‘mainTabContainer_tablist_tab_advancedtab’);
dtabs.parentElement.style.display=“none”;
//have to do onPageLoad because content isn’t there yet
});
-script-
#end
Hope someone finds this useful.
Had to use -script-, because the engine strips all HTML. Maybe there’s a markdown trick or something.