How to disable theme selection

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles 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

Purpose

When you want all spaces to follow the global look and feel, this page describes a way of preventing your space administrators from changing the theme in a space. 

Customisations are not supported

Note that Atlassian support does not cover customisations to Velocity files, such as those described on this page.

tip/resting Created with Sketch.

All files should be located under <confluence-install>\confluence\spaces.

Solution

Removing the Theme Selection Option

To remove the option that allows people to select a theme for a space, you will need to edit the Velocity template (.vm file) as described below.

  1. Locate your choosetheme.vm file under

    <confluence_install>\confluence\spaces\choosetheme.vm
  2. Edit this file with your favorite editor, such as Wordpad, Notepad or Notepad++ (recommended). The file looks something like this:

    <html>
    	<head>
    		<title>$action.getActionName($action.getClass().getName())</title>
        </head>
    
        #applyDecorator("root")
            #decoratorParam("helper" $action.helper)
            #decoratorParam("context" "space-administration")
            #decoratorParam("mode"  "view-space-administration")
            #decoratorParam("help-path" "/spaces/help/choosetheme.vm")
    
            <body>
                #applyDecorator ("root")
                    #decoratorParam ("context" "spaceadminpanel")
                    #decoratorParam ("selection" "choosetheme")
                    #decoratorParam ("title" $action.getActionName($action.getClass().getName()))
                    #decoratorParam ("selectedTab" "admin")
                    #decoratorParam("helper" $action.helper)
    
                    <form method="POST" action="dochoosetheme.action" name="choosethemeform">
                        #form_xsrfToken()
                        #parse ("/includes/common-choosetheme.vm")
                        <input type="hidden" name="changesSaved" value="true">
                        #tag ("Submit" "value='confirm.name'" "align='center'" "theme='notable'" "template='submit.vm'")
                    </form>
                #end
            </body>
    
        #end
    </html>
    
  3. Add a comment, as shown below, replacing the block that starts with "<form method..." and ends with "</form>". After the edit, you should have something like this:

    <html>
    	<head>
    		<title>$action.getActionName($action.getClass().getName())</title>
        </head>
    
        #applyDecorator("root")
            #decoratorParam("helper" $action.helper)
            #decoratorParam("context" "space-administration")
            #decoratorParam("mode"  "view-space-administration")
            #decoratorParam("help-path" "/spaces/help/choosetheme.vm")
    
            <body>
                #applyDecorator ("root")
                    #decoratorParam ("context" "spaceadminpanel")
                    #decoratorParam ("selection" "choosetheme")
                    #decoratorParam ("title" $action.getActionName($action.getClass().getName()))
                    #decoratorParam ("selectedTab" "admin")
                    #decoratorParam("helper" $action.helper)
    
    		   <h1>Dear Space Administrator,</h1><br>
    		   <p><font size="3" color="red">You cannot change this  Theme, we took so much effort building our Theme.<br>
                    Please continue to use the Global Look and Feel<br>
                    If you have any complains contact the Admin.<br>
                    Regards your Admin.<br></font></p>
    
                #end
            </body>
    
        #end
    </html>
    
  4. Save the file. You can reload your page and see the changes. There is no need to restart Confluence.

After following the above steps, you will have something like this:

Last modified on Dec 18, 2024

Was this helpful?

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