In this article we will be learning about trimming controls in SharePoint 2013 / SharePoint 2016 depending on logged in user. Site setting gear icon will appear only for the logged in user is owner or above. We will see how we can use spsecuritytrimmedcontrol in sharepoint 2013.
Objective :: Hide site setting gear option
In my application user want to hide the site setting gear icon / option for all the user 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 master page.
Solution :: Implement SPSecurityTrimmedControl
Follow the below steps to update the master page to hide the gear icon.
- Open the SharePoint site in SharePoint designer 2013
- Navigate to Master page part of All Files -> _catalogs
- Identify your custom master page and check out in advanced mode
- look for <span class=”ms-siteactions-root” id=”siteactiontd” >
- Copy the below code and paste right above that span tag
<SharePoint:SPSecurityTrimmedControl runat=”server” Permissions=”ManageSubWebs”>
After u 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:
Logged in user is contributor:
Hope this helps, happy branding in SharePoint 2013 / 2016 !!!
Download FREE SharePoint 2019 Installation PDF Guide
This FREE PDF contains, Steps by step guide to install SharePoint 2019 Preview, prerequisites, hardware and software new features. First impression to SharePoint Server 2019 new modern site, modern lists and modern document libraries.
You May Also like the Following SharePoint Online Tutorials: