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

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

Jarvin Li February 11, 2018

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

2 votes
Answer accepted
Christo Mastoroudes [Adaptavist]
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.
February 12, 2018

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.

Jarvin Li February 14, 2018

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?

Christo Mastoroudes [Adaptavist]
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.
February 15, 2018

Hi,

Try .remove() instead of .hide().

https://api.jquery.com/remove/

Like David Harkins likes this
1 vote
Max Foerster - K15t
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 12, 2018

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

Jarvin Li February 12, 2018

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

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 13, 2018

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

0 votes
Chris January 15, 2019

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>
Andreas Gratz June 21, 2022

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

Andreas

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events