How do I disable the create page button for a specific space?
Asked by Guy Toyber:

Hi,

I need to disable the creation button for specific spaces.

I found the code below that disables the creation button for all spaces. I need help adjusting it so I can still create pages in other spaces...

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

Any tips would be appreciated.

Thanks!


Answers:
author: Matthias Gaiser _K15t_
body: Hi [@Guy Toyber](/t5/user/viewprofilepage/user-id/4441499)

may I ask why you want to disable the creation button? How about using **Confluence's [space permissions](https://confluence.atlassian.com/doc/permissions-and-restrictions-139557.html#Permissionsandrestrictions-Spacepermissions)** in order to control who's able to create pages for specific pages in spaces? You can define per group or user who's able to do so. You could also restrict everyone from creating pages.

This way, you also prevent the creation of pages via the REST API.

Cheers,  
Matthias.

comments: author: Guy Toyber
body: Hi [@Matthias Gaiser _K15t_](/t5/user/viewprofilepage/user-id/853318)

Our Confluence is being migrated from Server to Data Center.

Before a space export we do restrict all users from editing. In this mode "edit" page is hide but "Create" page is visible.

Users can still create pages in other spaces, and since the create button is still visible the scenario of a user that will visit the limited space and will want to published a page there - it can happen - but the page will be published in another space.

In other words, the user intention will be to create a new page in the limited space but the result will be a new page in another space.

So to be on the safe side and to avoid confusion I would like to hide/disable the create button.

Regards,

Guy


author: Matthias Gaiser _K15t_
body: I understand, [@Guy Toyber](/t5/user/viewprofilepage/user-id/4441499). Thank you for your explanation - that makes sense to me then. And I think I have a solution for you. This call

```
AJS.Meta.get("space-key")
```

returns the current space key you are in. If you include that into an if statement into your code, you could check if the space key matches one of your moved ones.

Hope that helps,  
Matthias.


author: Guy Toyber
body: Hi [@Matthias Gaiser _K15t_](/t5/user/viewprofilepage/user-id/853318) ,

I appreciate your help so far, would you mind to paste the entire code? It did not work for me...

Additionally, If I would like to hide another create button on additional space, how it will work?

Regards,

Guy


author: Thiago Masutti
body: Hi [@Guy Toyber](/t5/user/viewprofilepage/user-id/4441499)

See if the following page helps.

<https://confluence.atlassian.com/confkb/how-to-hide-labels-in-confluence-page-using-javascript-in-specific-spaces-836603034.html>

Kind regards,  
Thiago Masutti


author: Guy Toyber
body: Hi Thiago,

Thanks for the info, its now working perfect!

I appreciate your help!

Regards,

Guy


author: Prudhvi Raju Kanithi
body: Hello [@Thiago Masutti](/t5/user/viewprofilepage/user-id/1209618) / [Matthias Gaiser _K15](https://community.atlassian.com/t5/user/viewprofilepage/user-id/853318)  

Can anyone help me? We are migrating from Confluence, and after migrating, we are removing permissions to some spaces, like 100 at once. Is there any script via script runner or custom HTML Java script that can help me remove permissions to some of the selective spaces?


Tags: confluence-server

css

javascript

server