How can I hide a nav bar for guest or normal users?

Last modified by Vincent Massol on 2023/05/16

This approach has been tested on both XWiki 13.10.10 and 14.9 versions.

For the global effect.

  1. First, ensure you are logged in to XWiki and have the necessary permissions to edit pages.
  2. Go to your profile page and enable an advanced user or use shortcut x+x+x+a, and enable displayed hidden pages or use shortcut x+x+x+h
  3. Open the Sandbox page or any page you want to edit.
  4. At the top right corner of the page, click on the "Edit" button and select "Object" or use shortcut "o"
  5. If this exists "Objects of type XWiki.StyleSheetExtension", then change the parameter "Use this extension" to On the demand only, and inside the field "Code" place the below-written code, otherwise create a new one.
    #hierarchy {
      display: none
    }

Finally:

  1. Navigate to the DefaultSkin page via shortcut and type "Skin" into search field
  2. Select Default XWiki Skin
  3. Press "Edit this skin"
  4. Add the new overriding template, name it layoutExtraVars.vm and place these lines of code in the content block. If a template already exists, you can place that code at the beginning or end of the existing customization code.
    #if(!$hasAdmin || $isGuest)
      #set ($discard = $xwiki.ssx.use('Sandbox.WebHome'))
    #end

Learn more about Skin extension.

Get Connected