Hide items in option menu
Asked by Julian Weiss:

How do I hide all the option items (Attachments, Page History, Page Information, View in hierarchy, etc.) except for Export to PDF?


Answers:
author: Mirek
body: Hi [@Julian Weiss](/t5/user/viewprofilepage/user-id/2147740) - Welcome to the Community!

Usually you can do it with CSS orr JavaScript code added to space layout. Please take a look on this page for examples:

<https://confluence.atlassian.com/confkb/how-to-hide-elements-in-confluence-using-css-or-javascript-313458894.html>

<https://confluence.atlassian.com/confkb/how-to-hide-the-space-tools-menu-for-anonymous-users-in-confluence-816877024.html>

comments: author: Julian Weiss
body: Thanks


author: Julian Weiss
body: Just tried it and it removes the space tools. I need to remove the options from the top right except for Export to PDF.


author: Mirek
body: Hi [@Julian Weiss](/t5/user/viewprofilepage/user-id/2147740),

Of course it it working :) .. Probably you are hiding the wrong menu item.. Below are actually two options that you (and everyone reading this) can use to hide items.

**Option A**

* Hide items one by one
* Keeping the Menu at the top right

Example code:

*JavaScript hack*

```
<script type="text/javascript">
?? ?AJS.toInit(function(){
?? ?? if (AJS.params.remoteUser == ''){
?? ??? ?AJS.$('#action-menu-primary').hide();
?? ??? ?AJS.$('#view-attachments-link').hide();
?? ??? ?AJS.$('#action-view-history-link').hide();
?? ??? ?AJS.$('#action-page-permissions-link').hide();
?? ??? ?AJS.$('#view-page-info-link').hide();
?? ??? ?AJS.$('#view-in-hierarchy-link').hide();
?? ??? ?AJS.$('#action-view-source-link').hide();
?? ??? ?AJS.$('#view-resolved-comments').hide();
?? ??? ?AJS.$('#action-view-storage-link').hide();
?? ??? ?AJS.$('#action-export-word-link').hide();
?? ??? ?AJS.$('#import-word-doc').hide();
?? ??? ?AJS.$('#action-copy-page-link').hide();
?? ??? ?AJS.$('#action-move-page-dialog-link').hide();
?? ??? ?AJS.$('#action-remove-content-link').hide();
?? ??? ?AJS.$('#action-menu-modify').hide();
????? }
?? ?});
</script>
```

++**Output:**++

![export_to_PDF.png](https://community.atlassian.com/t5/image/serverpage/image-id/35686i9AA2F8751FECE2C3/image-dimensions/561x207?v=v2 "export_to_PDF.png")

**Option B**

* Hide entire action menu
* Use User Macro to create a dynamic link to Export to PDF that can be used on a page in place where you want

Example code:

*JavaScript hack*

```
<script type="text/javascript">
?? ?AJS.toInit(function(){
?? ?? if (AJS.params.remoteUser == ''){
?? ??? ?AJS.$('#action-menu-link').hide();
????? }
?? ?});
</script>
```

*User Macro*

```
## Macro title: Show simple link to Export to PDF
## Macro has a body: N
## Body processing: No macro body
## Output: Link to export to PDF
##
## Developed by: Mirek (Community Champion) for Atlassian Community
## Date created: 23/10/2018
## URL: https://community.atlassian.com/t5/Confluence-questions/Hide-items-in-option-menu/qaq-p/920803#M123028

<a href="$req.contextPath/spaces/flyingpdf/pdfpageexport.action?pageId=$content.id" >Export this page to PDF</a>
```

**++Output:++**

![export_to_PDF_02.png](https://community.atlassian.com/t5/image/serverpage/image-id/35688i8271B0BBD0F0DDEE/image-dimensions/522x168?v=v2 "export_to_PDF_02.png")

I hope it helps.


author: Nic Brough -Adaptavist-
body: You will need to use a theming App to re-skin the pages, drawing up menus that do not include the functions (or not having a menu at all)

I would strongly recommend not doing this - it will frustrate your users to have useful functions removed.

comments: author: Mirek
body: [@Nic Brough -Adaptavist-](/t5/user/viewprofilepage/user-id/781454), I agree that it might frustrate users if something is not showing however mostly they are actually not Confluence power users and most of them do not know which option is where and what permission is required to do something. If [@Julian Weiss](/t5/user/viewprofilepage/user-id/2147740) want to hide this for anonymous users it is reasonable. Actually this is just hiding, if someone is clever enough he can still show things on specific actions or use direct URL to action. It is all just JavaScript... See simple 2 examples that I provided in my answer to see how it can be done without theming app.


author: Nic Brough -Adaptavist-
body: \>most of them do not know which option is where and what permission is required to do something

That's fine, if you remove their permissions, they will only be offered options (hopefully well named ones) that they can use. I would push back and question

* why the handful of options they can still see are still there if the permissions are correct
* Of the remaining permissioned options, why there's any benefit in removing them


author: Mirek
body: Hmm.. Not sure if I follow your question Nic, but overall it is all about the UI not permissions. Take a look on Atlassian Documentation (that is Confluence based) and try to answer why it looks like this (not default Confluence documentation theme like it was for many years). For me old was better to use that now I need to use the new view.. I do not see hierarchy or a page, attachments or page history anymore.. Everything was handful even that did not do any damage. Atlassian just decided to "make it simple" for everyone.

In general someone might not like default menus and it is their decision what they show and what they hide (or allow) for specific group of users either by permissions or UI changes.

On the other hand I know people that like only to see things that they use. For one of the customers for example one single high senior VP did not like Confluence default dashboard and the solution was to hack the UI only for him even there are very useful information (from the Atlassian point of view)

So as soon as you control that it is fine.


author: Nic Brough -Adaptavist-
body: I was concentrating on the options you can remove with permissions.

But for things people not controlled with permissions, I don't understand why anyone would want to remove options that people find useful.


author: Julian Weiss
body: Thanks everyone for the inputs. Combining together I resolved it with the following defined in the stylesheet for the space:

\<style type="text/css"\>  
#action-menu-primary { display: none !important; }  
#view-attachments-link { display: none !important; }  
#action-view-history-link { display: none !important; }  
#view-page-info-link { display: none !important; }  
#view-in-hierarchy-link { display: none !important; }  
#action-view-source-link { display: none !important; }  
#view-resolved-comments { display: none !important; }  
#action-export-word-link { display: none !important; }  
\</style\>


author: Bill Bailey
body: Really curious about the use model for removing all these options.

Visibility of those items is also controlled via permissions. So if there are a set of users you want to restrict these options from, set their permission levels to not allow attachments, for example.

comments: author: Julian Weiss
body: We want to restrict anonymous users to just search and export to PDF functionality.


author: Bill Bailey
body: What permissions do you have currently set for anon users?


author: Julian Weiss
body: View only.


author: Bill Bailey
body: And view only doesn't disable those menu items?

And unless you have export space permissions enabled for anon, they will not be able to create a PDF.


author: Julian Weiss
body: Nope - the site is <https://kb.ctera.com/>. It is still being developed but you can see it.


Tags: confluence-server

server