Hiding Other Manager Page Elements

Using CSS to hide other Manager Page Elements


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.


MODX logo

The Question Mark

Another thing you might want to hide, is the little question mark at the right side of the Top 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, and a link for commercial support for your site. There is also a form to sign up for emailed MODX updates. Also included, are links to follow MODX on various social media platforms. You might not want to show this to some users, however. 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, 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 in internal class to hide something without hiding it's 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, fixing the plugin would just be a matter of finding the new identifier and updating the plugin code.


Coming Up

In the next article, we'll see how to hide the System Menu (Gear Icon) from non-Administrators.


For more information on how to use MODX to create a web site, see my web site Bob's Guides, or better yet, buy my book: MODX: The Official Guide.

Looking for high-quality, MODX-friendly hosting? As of May 2016, Bob's Guides is hosted at A2 hosting. (More information in the box below.)



Comments (0)


Please login to comment.

  (Login)