Here we will discuss how to hide site settings or gear icon from users other than site owners in SharePoint 2013 or SharePoint 2016. There are various ways to hide site settings icon from SharePoint 2013/2016.
Here we will discuss trimming controls in SharePoint 2013 / SharePoint 2016 depending on logged in user.
Site setting gear icon will appear only for the logged-in user who is an owner or above in SharePoint 2013/2016. We will see how we can use spsecuritytrimmedcontrol in SharePoint 2013.
Hide Site setting gear icon in SharePoint 2013
In my application user want to hide the site setting gear icon/option for all the users other than site owners and above. As we all know that in SharePoint 2013 and SharePoint 2016 site settings gear icon is available for all the users.
If we want to achieve this across the site, we have to implement this change in the master page.
Check How to Change favicon in SharePoint Online/2013/2016
Implement SPSecurityTrimmedControl in SharePoint 2013/2016
Follow the below steps to update the master page to hide the gear icon in SharePoint 2013/2016.
- Open the SharePoint 2013 site using SharePoint designer 2013
2. Navigate to Master page part of All Files -> _catalogs
3. Identify your custom master page and check out in advanced mode
4. Look for <span class=”ms-siteactions-root” id=”siteactiontd”>
5. Copy the below code and paste right above that span tag.
<SharePoint:SPSecurityTrimmedControl runat="server" Permissions="ManageSubWebs">
After you add this line it will like as below and ensure that you close this tag properly.
Once you are done with your changes publish the latest master page and the output will be as follows:
Logged in user is site owner
Now if you logged into the SharePoint 2013 site as a SharePoint site owner, then you can see they can see the settings or gear icon like below:
Logged in user is a contributor:
Now if a user will logged in as a contributor then you can see the settings or gear icon in SharePoint 2013.
You can also verify the user has contribute permission to the SharePoint site.
You may like the following SharePoint customization tutorials:
- SharePoint 2016 usage analytics
- Approve/Reject documents or items using Content Approval in SharePoint Online or SharePoint 2016/2013
- Rating and Generate File plan Report in SharePoint 2013/2016 Document Library
- SharePoint 2013 Add Recycle Bin link in the quick launch
- Customize access denied page in SharePoint 2013
- Ribbon control missing for list in SharePoint Online
Here in this SharePoint customization tutorial, I have explained how to use SPSecurityTrimmedControl in SharePoint 2013/2016. How to hide site settings SharePoint 2013 or hide the gear icon in SharePoint 2013/2016. Hope this helps, happy branding in SharePoint 2013 / 2016 !!!
I am Krishna.Vandanapu a SharePoint architect working in IT from last 13+ years, I worked in SharePoint 2007, 2010, 2013, 2016 and Office 365. I have extensive hands on experience in customizing SharePoint sites from end to end. Expertise in SharePoint migration tools like Sharegate, Doc Ave and Metalogix. Migrated SharePoint sites from SharePoint 2007 to 2010 and 2010 to 2013 several times seamlessly. Implementing CSOM with Microsoft best practices. Spent quality time in configuring SharePoint application services like User Profile, Search, Managed Meta data services etc. Now exploring SharePoint Framework and SharePoint 2019
great step by step guide until …..”ensure that you close this tag properly”
(sigh)
Thank you, I am very happy that it helped you!
how do you close the tag?
Hi James,
you can close the tag with the /> end of the SharePoint:SPSecurityTrimmedControl tag
Hope this helps !!!
-Krishna
So, something like the code below? “Read” users see “Sorry, no access” page when they try to access the site. What am I doing wrong?
<SharePoint:SiteActions runat="server" accesskey="”
id=”SiteActionsMenuMainData”
PrefixHtml=””
SuffixHtml=””
ImageUrl=”/_layouts/15/images/spcommon.png?rev=40″
ThemeKey=”spcommon”
MenuAlignment=”Right”
LargeIconMode=”false”
>
<SharePoint:MenuItemTemplate runat="server"
id="MenuItem_ShareThisSite"
Text="”
Description=””
MenuGroupId=”100″
Sequence=”110″
UseShortId=”true”
PermissionsString=”ViewPages”
PermissionMode=”Any” />
<SharePoint:MenuItemTemplate runat="server" id="MenuItem_EditPage"
Text="”
Description=””
ImageUrl=”/_layouts/15/images/ActionsEditPage.png?rev=40″
MenuGroupId=”200″
Sequence=”210″
PermissionsString=”EditListItems”
ClientOnClickNavigateUrl=”javascript:ChangeLayoutMode(false);” />
<SharePoint:MenuItemTemplate runat="server" id="MenuItem_CreatePage"
Text="”
Description=””
ImageUrl=”/_layouts/15/images/NewContentPageHH.png?rev=40″
MenuGroupId=”200″
Sequence=”220″
UseShortId=”true”
ClientOnClickScriptContainingPrefixedUrl=”OpenCreateWebPageDialog(‘~siteLayouts/createwebpage.aspx’)”
PermissionsString=”AddListItems, EditListItems”
PermissionMode=”All” />
<SharePoint:MenuItemTemplate runat="server" id="MenuItem_Create"
Text="”
Description=””
MenuGroupId=”200″
Sequence=”230″
UseShortId=”true”
ClientOnClickScriptContainingPrefixedUrl=”GoToPage(‘~siteLayouts/addanapp.aspx’)”
PermissionsString=”ManageLists, ManageSubwebs”
PermissionMode=”Any” />
<SharePoint:MenuItemTemplate runat="server" id="MenuItem_ViewAllSiteContents"
Text="”
Description=””
ImageUrl=”/_layouts/15/images/allcontent32.png?rev=40″
MenuGroupId=”200″
Sequence=”240″
UseShortId=”true”
ClientOnClickNavigateUrl=”~siteLayouts/viewlsts.aspx”
PermissionsString=”ViewFormPages”
PermissionMode=”Any” />
<SharePoint:MenuItemTemplate runat="server" id="MenuItem_ChangeTheLook"
Text="”
Description=””
MenuGroupId=”300″
Sequence=”310″
UseShortId=”true”
ClientOnClickNavigateUrl=”~siteLayouts/designgallery.aspx”
PermissionsString=”ApplyThemeAndBorder,ApplyStyleSheets,Open,ViewPages,OpenItems,ViewListItems”
PermissionMode=”All” />
<SharePoint:MenuItemTemplate runat="server" id="MenuItem_Settings"
Text="”
Description=””
ImageUrl=”/_layouts/15/images/settingsIcon.png?rev=40″
MenuGroupId=”300″
Sequence=”320″
UseShortId=”true”
ClientOnClickScriptContainingPrefixedUrl=”GoToPage(‘~siteLayouts/settings.aspx’)”
PermissionsString=”EnumeratePermissions,ManageWeb,ManageSubwebs,AddAndCustomizePages,ApplyThemeAndBorder,ManageAlerts,ManageLists,ViewUsageData”
PermissionMode=”Any” />
<SharePoint:MenuItemTemplate runat="server" id="MenuItem_SwitchToMobileView"
Visible="false"
Text="”
Description=””
MenuGroupId=”300″
Sequence=”330″
UseShortId=”true”
ClientOnClickScript=”STSNavigate(StURLSetVar2(ajaxNavigate.get_href(), ‘mobile’, ‘1’));” />
I followed your directions however, it did not work.
i used this way but didn’t work
Hi I’m trying the above solution as it sounds quite straight forward, however I’m slightly confused on point 3. How do I know which is my custom master page?
In the location ‘./_catalogs/masterpage’ I have the following files:
minimal.master
oslo.master
oslo.preview
seattle.master
seattle.preview
v4.master
Only ‘oslo.master’ has the ” but if I make the above change in this I get the following error message:
Site Definition Page Warning
Saving your changes will customize this page so that it is no longer based on the site definition. Do you want to continue?
Please advise?