Hi!
I need to disable the create button along with the template button for specific groups.
Any tips would be appreciated.
Thanks!
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's correct. Create page and Edit are the same permission.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.