How to hide the Space Tools menu for certain users or groups in Confluence
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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
Summary
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.
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.
Solution
How to hide Space Tools menu for Anonymous users
Navigate to Confluence Administration page >> Custom HTML.
Click Edit.
Add the following to At the end of the HEAD section and click Save:
1 2 3 4 5 6 7
<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
Navigate to Confluence Administration page >> Layout.
Under the Site Layouts, search for Main Layout and click Edit/Create Custom.
Find the following section:
<head>
and</head>
tags.Copy and paste the following code before the
</head>
tag.1 2 3 4 5 6 7 8
#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
Navigate to the specific Space you want to apply this changes to.
Go to Space Tools >> Look and Feel panel and click Layout.
Under the Site Layouts, search for Main Layout and click Edit/Create Custom.
Find the following section:
<head>
and</head>
tags.Copy and paste the following code before the
</head>
tag.1 2 3 4 5 6 7 8
#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
Save the changes.
Was this helpful?