How to hide More Actions menu?

Last modified by Thomas Mortagne on 2023/10/10

The goal of this FAQ is to remove the "More Actions" (hamburger-style menu) visible on:

MenuVisible.png

Perform one of the the following methods to remove the "More Actions" menu:

 

Method 1: Customize your skin

This method has been tested on both XWiki 11.10.4 and 12.3. Use Skin application to customize your skin.

To make changes on you skin you need to be have Administer rights.

Adding an overridden template object

  • Go to the Administration, in the "Look & Feel" section
  • Enter the name of the skin to edit (by default: XWiki.DefaultSkin).
  • Click on "Customize".
  • You will get the skin edition page
  • Go to the "Overridden templates" section:
  • Enter the name of the template that you want to override. In this case layoutExtraVars.vm

    By overriding this .vm file you can safely override layout variables that are in layoutvars.vm.
    Other  templates that can be overridden e.g.: view.vm, footer.vm, style.css, etc...

  • You need to add your restrictions:
    ## Hide More Action Menu if the user not an admin
    #set($currentUserGroups = $services.user.group.getGroups($xcontext.user, 'xwiki', $true))
    #set($userGroupReference = $services.model.createDocumentReference('xwiki', ['XWiki'], 'XWikiAdminGroup'))
    #if (!($currentUserGroups.contains($userGroupReference) || $hasAdmin))
      #set($displayMoreActionsMenu = false) ## more actions menu
      #set($displayAdminMenu = false) ## the admin menu, related to the page
    #end

Also you may find helpful details on this Skin tutorial.

Note that there's a small bug present XWiki versions older than 11.10.5 or 12.3-rc-1.

Method 2: Create Skin extension

This method has been tested on XWiki 11.10.4. Add StyleSheet extension object:

  • Create a page, e.g. MyCode.MoreActionsMenuCustomization.
  • And edit the page with the Object editor. The page itself can be any XWiki page - an existing page or a new page.
  • From the "New Object" drop-down list of the object editor choose XWiki.StyleSheetExtension. Then, click the "Add" button. We will name it "Hide More Action Menu", give it a default cache policy, ask it to parse the content, and write the following code:
    ## Hide tabs if the user is not internal or not an admin
    #set($currentUserGroups = $services.user.group.getGroupsFromAllWikis($xcontext.userReference)
    #set($internalUserGroupReference = $services.model.createDocumentReference('xwiki', ['XWiki'], 'XWikiAdminGroup'))
    #if (!($currentUserGroups.contains($internalUserGroupReference) || $hasAdmin))
      #tmMoreActions {
       display: none;
      }
    #end

    You can ask to have it used "Always on this wiki". For this to happen however, you need to save the extension document with programming rights.
    SSX.png

  • Just click "Save and View" .

    MenuHidden.png

Learn more about Skin Extension.

Tags:
   

Get Connected