Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,298,897
Community Members
 
Community Events
165
Community Groups

How do I disable the create page button along with the template button?

Hi!

I need to disable the create button along with the template button for specific groups.

Any tips would be appreciated.

Thanks!

 

3 answers

1 accepted

Hi, 

You can achieve this with some javascript. Some coding knowledge is required.

You need to navigate to Confluence Administration -> Custom HTML.

In the head section you will have to write some javascript. The next bit of code will hide the create button for all users:

<script type="text/javascript">
AJS.toInit(function(){
AJS.$('#quick-create-page-button').hide();
});
</script>

All javascript code will have to be between the <script> tags.

 

If you want to hide the button for specific groups it becomes a little harder. But you will need to do the following logic steps.

1. Get the current user: something like this:

var userName = AJS.params.currentUserFullname;

2. Once you have the username do a rest call to find out which groups the user belongs to

AJS.$.ajax({
 dataType: 'json',
 contentType: 'application/json',
 type: 'GET',
 url: AJS.params.baseUrl + '/rest/api/user/memberof?username=userName',
 success: function(groupData){
    //evaluate groupData and put code here to show or hide the buttons
 }
});

 

The code above is not perfect or tested, but should be close to what you need.

 

If this answers your question please mark it as resolved.

Hi there, I did the first option you presented. There is a bit of a problem though, I was curious and tried viewing the menu bar with inspect element, and i could still show the button by changing the code.

Is there a way for me to hide it and not let anybody see it in inspect element?

1 vote

Hi Jarvin,

is this system-wide or for a space? Can't you solve that using the default space permissions and NOT granting them the "add pages" permission?

Best, Max

Hi Max,

It's system wide, we are also using a macro called Scaffolding, if I disable the permission it also disables the ability to edit the content of a page. I only need to disable the creation of a page.

Regards,

Jarvin

That's correct.  Create page and Edit are the same permission.

Also for those just wanting the quick create button to be hidden and the create from template to be used only for Dashboards you can insert the below under the Edit Site Layouts>Global Layouts.

Make sure your inserting this in between "#if ($mode == "dashboard") and #else

<script type="text/javascript">
AJS.toInit(function(){
AJS.$('#quick-create-page-button').hide();
AJS.$('#create-page-button > span.aui-iconfont-more').removeClass("aui-icon aui-icon-small aui-iconfont-more");
});
</script>
<style>
#create-page-button {
border-bottom-left-radius: 3.01px;
border-top-left-radius: 3.01px;
}
</style>

Hi!
Would this also work for the Cloud?
Best,

Andreas

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

An update on Confluence Cloud customer feedback – June 2022

Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...

235 views 2 4
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