How to hide the Space Tools menu for certain users or groups in Confluence

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

This guide is for informational purposes and is not eligible for support from Atlassian.  If you have any questions about the information on this page, please reach out to our Atlassian Community for help. 

Purpose

The Space Tools menu allows Space Administrator to manage their Spaces. If you need to disable the Space Tools menu for certain users you may do so by using JavaScript.

How to hide Space Tools menu for Anonymous users

  1. Navigate to Confluence Administration page >> Custom HTML.
  2. Click Edit.
  3. Add the following to At the end of the HEAD section and click Save:

    <script>
      AJS.toInit(function(){
        if (AJS.params.remoteUser == ''){
          AJS.$("#space-tools-menu-trigger").hide();
        }
      });
    </script>

How to hide Space Tools menu for users that are not members of confluence-admin group

Site-wide changes
  1. Navigate to Confluence Administration page >> Layout.
  2. Under the Site Layouts, search for Main Layout and click Edit/Create Custom.
  3. Find the following section: <head> and </head> tags.
  4. Copy and paste the following code before the </head> tag.

    #if ($userAccessor.hasMembership('confluence-administrators', $helper.action.remoteUser.name))
    #else
        <script type="text/javascript">
        AJS.toInit(function(){
    AJS.$('#space-tools-menu-trigger').hide();
        });
    </script>
    #end
Space-wide changes
  1. Navigate to the specific Space you want to apply this changes to.
  2. Go to Space Tools >> Look and Feel panel and click Layout.
  3. Under the Site Layouts, search for Main Layout and click Edit/Create Custom.
  4. Find the following section: <head> and </head> tags.
  5. Copy and paste the following code before the </head> tag.

    #if ($userAccessor.hasMembership('confluence-administrators', $helper.action.remoteUser.name))
    #else
        <script type="text/javascript">
        AJS.toInit(function(){
    AJS.$('#space-tools-menu-trigger').hide();
        });
    </script>
    #end
  6. Save the changes.








Last modified on Apr 13, 2022

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.