Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to hide #user-menu-link for a special usergroup?

Deleted user March 29, 2016

Hi guys,

my question today is: How to hide #user-menu-link for a special usergroup using ajs?

confluence-readonly should be the usergroup.

I've tried some ajs, but nothing works fine for me

...

<script type="text/javascript">

    AJS.toInit(function(){

    console.log(AJS.params.remoteUser);

    if ($userAccessor.hasMembership('<confluence-readonly>', AJS.params.remoteUser)){

              AJS.$('#user-menu-link').hide();

        }

    });

</script>

Regards,

Dennis

 

2 answers

0 votes
Deleted user March 29, 2016

Thanks Panos,

 

it works for me. But how can i place the macro to all pages additionally without editing all pages?


Regards

Panos
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 29, 2016

I can't test it out for you, but the guy in the answer i've linked demonstrates how to put this code in all pages. Did you try it?

Stephen Deutsch
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 29, 2016

Hi, guy from the answer here smile

If you're running a newer version of Confluence, you should also be able to use the same syntax as I mentioned for the documentation theme.  You'll need to click on the Gear icon, go to "General Configuration", and under "Look and Feel" click the "Sidebar, header and footer" link, and you could probably stick it in either the header or the footer box.

Panos
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 29, 2016

^^

0 votes
Panos
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 29, 2016

You have mixed velocity with javascript, it doesn't work like this i am afraid. Javascript knows nothing about useraccessor, pagemanager etc.

I'll redirect you to this https://answers.atlassian.com/questions/321823.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events