How to remove the admin tool box located on top right

Hi,

I have the latest zenphoto installed.

I CAN create any group, user, And test with those users, i always have on top right corner a box, called admin toolbox ( not sure un English)

I would like to hide it except for admin user.

Any idea ?

Thanks
Olivier
Tags:

Comments

  • In your theme `functions.php` script add the following lines of code:

    `if (!zp_loggedin(ADMIN_RIGHTS)) zp_remove_filter('theme_body_close', 'adminToolbox');`

    But understand that your users may not appreciate this--the toolbox is tailored to the user's rights, so only shows things that he can do. Removing the quick links simply makes him have to type in the direct link.
  • Thank you!

    I was looking for a way to do this as well. And was contemplating changing template_functions.php, but really didn't want to. ;-)

    Reason for this is that I want to allow visitors to register so that they do not have to see the captcha thing, but still have no admin rights.

    Still have a few things to figure out though, such as forgotten password, redirect after logging in, etc.

    ...jim
  • Not even the right to change their password??????
  • That would be covered under "etc.". ;-)

    Regards,
    ...jim
  • Quick note for anyone else wanting to use this...

    zp_remove_filter requires that the priority of the filter match what is stored. In this case, the priority of adminToolbox is 5. zp_remove_filter defaults to priority 10. Therefore, the priority has to be passed in this case.

    `if (!zp_loggedin(ADMIN_RIGHTS)) zp_remove_filter('theme_body_close', 'adminToolbox', 5);`

    ...jim
  • I have tried the fix above, as I don't need the admin area to be visible to non-admin logged in users, especially as the user_login-out plugin and the favoritesHandler plugin makes the admin area old-fashioned looking and redundant.

    When I try the fix above, using the zpBootstrap theme, the tools do indeed disappear for non-admin users, but the space they take at the top of the page remains, throwing off the look of the site. I can't figure out what to do to make the bar at the top disappear as well.

    In the theme's inc_header template, zp_apply_filter('theme_head'); is the code that shows that bar (and the tools, typically), but that is needed for the logged-in admin. It seems to be an all-or-nothing fix.

    Is there a way to remove the full admin area for non-admins, as suggested in the post above, rather than just removing the tools on the admin bar at the top of the site's pages while leaving that bar? I feel this should be a CSS issue, but I can't figure it out.

    Thanks in advance for any help!

    Thoughts?

  • acrylian Administrator, Developer

    You would have to create a filter type plugin to remove the function from the filter. That needs to check for the rights level of the user and then use zp_remove_filter('theme_body_close', 'adminToolbox'); to remove the filter.

  • david1pro Member
    edited October 7

    Thanks for the reply. Creating a plugin sounds way above my head. I was hoping there were a simpler way to make that antiquated bar and the space it takes at the top of the page go away for logged-in non-admins, as they don't need it. So far, I can only make the bar go away, but the space that held it remains.

    Is there a way to at least style it? The colors clash so it sticks out like a sore thumb when a non-admin is logged in, and also wastes space at the top of the page. Forum search results for "style admin" and "css admin" return no results.

  • acrylian Administrator, Developer

    Sorry, we choose not to overload everything with even more options for too specific thing than we have.

    You can try that in the theme's functions.php - technically sort of a plugin too - but it may be too late in the load order (I have not tried this). And of course you have to think about that theme change on every theme update…

  • Thanks... I did find the zp-core/admintoolbox.css, so I can make the bar match the rest of the site with that, which may be all I need. Can I override this in my theme somehow, or should I just change this directly and then have a copy to use if it is updated in a zenphoto core update?

  • acrylian Administrator, Developer

    You should be able to override that via the theme.css.

    The admin toolbox should actually look the same because it is part of the backend rather than the theme. If we refer to it will talk of a gray bar on top. It might cause support misunderstandings it if is for example green on your theme ;-) In early themes it was just a button that could even be placed in different corners by themes.

    So actually you have sort of subscriber users that basically have no rights except their own account (which they need to if you have to care for the GDRP for example)? Then we could think indeed about it if these "no rights" users really need it.

  • I only need it so family users can see some lineages pages (full life-details need not be free to the public, DOB, etc.) and so they can collect favorite pictures with the favorites plugin. All I really want is a little place they can log in and those things work. I don't really need a persistent admin bar at the top, as one can make a favorites page link anywhere they want on the site that only appears when logged in. A small log-in/log-out link can be created anywhere one wishes with the loginout plugin. The forced whole bar seems a bit of a waste of space, esp. as it is persistent. I've at least made mine match my theme, but really, having less powerful font-end users being able to log in and not see the bar, as the bar is unnecessary, would be best, while still having it so myself, the full admin, would have the bar.

  • fretzl Administrator, Developer
    edited October 12

    A plugin is of course much better but this ugly solution may help for now.
    Copy this code into functions.php in the zpBootstrap theme folder.

    function removeAdmintoolbox() {
        ?>
        <style type="text/css">
            body {
                margin-top: 0 !important;
            }
    
            #zp__admin_module {
                display: none !important;
            }
        </style>
        <?php
    }
    
    
    if (!zp_loggedin(ADMIN_RIGHTS)) { 
        zp_register_filter('theme_head', 'removeAdmintoolbox');
        zp_remove_filter('theme_body_close', 'adminToolbox', 5);
    }
    
  • Thank you so much! That worked perfectly for me. I now only have the admin area for myself, and not for my users. I appreciate it!

Sign In or Register to comment.