In the previous article, we used a plugin to hide the "Help" button that appears on the panel for creating and updating various MODX objects like Resources, Elements, System Settings, and Media Sources. In this article we'll look at some other Manager-page elements you can hide the same way.
The Question Mark
Another thing you might want to hide, is the little question mark at the right side of the Main Menu. It's kind of cool since it brings the MODX support system into the Manager, providing links to the MODX Forums, the Bug Tracker, the MODX documentation, a link for commercial support for your site, and other things. You might not want to show this to some users, though. This code will hide it from users who are not members of the Administrator group:
if (! $modx->user->isMember('Administrator')) {
$css = '
<style>
#limenu-about {
display: none !important;
}
</style>
';
$modx->regClientCSS($css);
}
return '';
We could hide the question mark and the help button from non-administrators with this code:
if (! $modx->user->isMember('Administrator')) {
$css = '
<style>
#limenu-about {
display: none !important;
}
#modx-abtn-help {
display: none !important;
}
</style>
';
$modx->regClientCSS($css);
}
return '';
Finer Control
What if you want to hide the help button from everyone, but the question mark just from non-Administrators? This code will do that:
$css = '
#modx-abtn-help {
display: none !important;
}
';
if (! $modx->user->isMember('Administrator')) {
$css .= '
#limenu-about {
display: none !important;
}
';
$css = '<script>' . $css . '</script>';
$modx->regClientCSS($css);
}
return '';
Other Elements
The process used above will work for any Manager-page element that has an ID or class (and they all do). To find the identifier using Dev. Tools, see the technique described in the first "Hiding the Help Button" article (about three posts ago).
There may be cases where you need to use an internal class to hide something without hiding its container in order to preserve the layout, but usually there is an ID for the container and hiding it will work fine since, in theory, the MODX Manager template is designed to allow these things to be hidden. I would not recommend using the classes that end in a number. The numbers are generated dynamically, and could change in a different version of MODX. It's possible that the IDs could also change, but if that happens (and it's unlikely), fixing the plugin would just be a matter of finding the new identifier and updating the plugin code.
Security Note
You might be tempted to use the method above to hide the sensitive areas like the System Menu (gear icon), but keep in mind that, if they know how, users can examine the source code of the page, or inspect it in dev. tools like we did. That will expose the actual links to the various parts of the Manager that you've hidden. A Manager User can then paste those links into the browser's address line and get to those parte of the Manager even though you've hidden them from view.
Coming Up
In my next article, we'll see how to have finer control over whether a plugin executes.
About Bob Ray
Bob Ray is the author of the MODX: The Official Guide and dozens of MODX Extras including QuickEmail, NewsPublisher, SiteCheck, GoRevo, Personalize, EZfaq, MyComponent and many more. His website is Bob’s Guides. It not only includes a plethora of MODX tutorials but there are some really great bread recipes there, as well.
Learn more about Bob Ray.