[All Adaptavist Apps]

Page tree

 

Personalising the Standard Menus

Alter the standard View and Edit menus, or items within them, based on the logged in user...

Overview

Although items on the inbuilt View and Edit menus will automaticlaly be hidden based on the privileges of the user (eg. if they can't edit pages then the Edit this page... item won't appear), there are times when you want to hide these menus, or items on them, based on specific groups, etc.

This isn't a security measure! Hiding these items doesn't prevent access to them, it merely hides the links to them. If you want to forcibly restrict users privileges, use Space Permissions instead.

Alternatively, you might want to highlight specific menu items to make common tasks for a specific user or group of users more obvious, etc.

This tutorial shows you how to apply stylesheets to every page in a space in order to customise the inbuilt menus and their items throughout the space for specific users or groups, etc.

User specific style sheets

In our tutorial on View and Edit Menus, we explained how to use style sheets to change the colours of menus and items, hide items and even add additional text to items.

In this tutorial, we'll be using the same style sheets as the other tutorial, however we'll be selectively applying them based on the logged in user.

The footer

On the theme configuration screen, scroll down to the Custom Footer panel (no, we've not gone insane):

The footer is rendered on every page within a space so it's the perfect place to add macros if you want them to apply on every page (wink)

We'll be adding our style sheets to the footer using the style macro and we'll be using macros such as the show-to macro and hide-from macro to include or exclude those style sheets.

Example

Let's say we want to hide the View > Account menu from registered users, we'd add the following to the footer:

{show-to:groups=confluence-users}
{style}
.menu-account {
 display: none;
 visibility: false;
}
{style}
{hide-from}

The show-to macro, as used above, will "show" it's contents – in this case a style sheet – to users in the confluence-users group. In order to be in that group, the user must be a registered user and be logged in to the site.

If the style sheet is shown (in our case, only to logged in users), then the Account menu will be hidden.

If the style sheet is not shown (ie. a user that's not logged in), then the Account menu will remain visible.