It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Hide sidebar to specific user (confluence 6.6)

Stefano Delbello Apr 12, 2018

Hello

I created this user macro to completely hide sidebar (I don't want the sidebar to be seen in any way) in Confluence 6.6.1 

## Macro Name: hide-sidebar
<script>
$(window).load(function() {
$('body#com-atlassian-confluence.theme-default.aui-layout.aui-theme-default div#page div#full-height-container div.ia-splitter div.ia-fixed-sidebar').hide();
$('body#com-atlassian-confluence.theme-default.aui-layout.aui-theme-default div#page div#full-height-container div.ia-splitter div#main.aui-page-panel').css('margin-left', '0');
});
</script>

This is applied to a single Space in "Look & Feel" -> "Sidebar, header & footer" area, using wiki markup.

How can I change this user macro in order to apply it only to a specific user? I mean something like this

if (user-info:username =="Charlie") then

Thank you in advance

1 answer

1 accepted

2 votes
Answer accepted
Thomas Schlegel Community Leader Apr 12, 2018 • edited

Hi Stefano, 

this should do it:

## @noparams

#set( $username = "$req.getRemoteUser()" )
#if($username.equals("Charlie"))
<script>
$(window).load(function() {
$('body#com-atlassian-confluence.theme-default.aui-layout.aui-theme-default div#page div#full-height-container div.ia-splitter div.ia-fixed-sidebar').hide();
$('body#com-atlassian-confluence.theme-default.aui-layout.aui-theme-default div#page div#full-height-container div.ia-splitter div#main.aui-page-panel').css('margin-left', '0');
});
</script>
#else
do-nothing
#end
Stefano Delbello Apr 13, 2018

It works perfectly!

I only deleted the " #else do-nothing" rows because text "do-nothing" can be written into the page.

Thank you very much Thomas! :)

Thomas Schlegel Community Leader Apr 13, 2018

You're welcome, @Stefano Delbello

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Confluence

6 Awesome Ways to Apply Trello, JIRA and Confluence to your Project

I attended  Atlassian Summit 2019  and learned a lot from the presenters, attendees and knowledgeable Atlassian product managers. The presentations I attended focused on applying Agile, pla...

915 views 6 17
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you