Hide UI Element Built-In Script
The Atlassian applications are supremely flexible, but this comes at the cost of some complexity.
This built-in script allows you to hide any system web item or panel, or those that are provided by plugins.
To be more specific, it allows you to add additional conditions to these UI elements, so you can control more precisely when they are displayed.
you can hide the page or space export links, in certain spaces or allow it for particular users only
you can hide the social features, such as Like, Follow and so on
|Don’t confuse your users. If you are removing a menu item, make sure you document it and explain to your users why it’s not available.|
|This built-in script will only hide the web item - if your users can work out the URL that is invoked, they will be able to do the action. This is more for the purpose of reducing clutter, to allow users to focus on the most important elements in the user interface.|
|Don’t confuse Atlassian Support. Please don’t forget you have done this and raise a support request with Atlassian. You can see all the hidden items at Admin → Script Fragments, alternatively, disabling ScriptRunner will restore anything that it is hiding.|
As always, let’s start with an example.
Hide Export to PDF Item
Let’s say you wish to disable the Export to PDF and Export to Word functionality for the pages in one project.
Go to Admin → Script Fragments, and select Hide system or plugin UI element. Enter the following form details:
|You will not always know the key of the item you wish to ask. Start typing some characters in the name, and use trial and error.|
The condition we have used means that these operations will only be visible in the two spaces mentioned. If you want to hide it in just one or two spaces, then negate the condition. For example, this condition will mean the option is visible in all spaces except
! (context.space?.key in ["SPD"])
The section on conditions in Web Items is relevant here too.
The following shows the menu "before and after" you save the "hide items" built-in script:
|You can only further restrict the provided conditions. For example, the Export operation requires that the current user has View page permissions in the current space. If the user does not have those permissions, it won’t be displayed regardless of any condition you configure.|
Hiding Social Features
Set up the "hide UI elements" form as follows:
import com.atlassian.plugin.PluginController import com.atlassian.sal.api.component.ComponentLocator def pluginController = ComponentLocator.getComponent(PluginController) pluginController.disablePluginModule("com.atlassian.confluence.plugins.confluence-like:content-like-resources") pluginController.disablePluginModule("com.atlassian.confluence.plugins.confluence-like:mobile-content-like-resource")
The "Follow" link remains in the user hover inline dialog. As far as I can see, the only way to remove it is by editing