How to hide the gear icon (Site Actions) for all the users except the Admin group?


Put your gear icon between SpSecurityTrimmedControl to hide or show based on user permission.

<Sharepoint:SPSecurityTrimmedControl runat="server"
Your Gear ICon

or use below:

<SharePoint:SPSecurityTrimmedControl ID = "spstcSiteActions" runat = "server" PermissionsString = "ManageWeb">

<span ribbon">

<PublishingSiteAction:SiteActionMenu runat="server"/>

  • What do you mean by "Your Gear ICon"? Where it is used?
    – Gracy
    Feb 29 '16 at 13:07
  • the span of your gear icon. do inspect element
    – Taran Goel
    Feb 29 '16 at 13:28
  • @TaranGoel, is this in the master page?
    – Erin L
    Feb 29 '16 at 13:55
  • Yes gear icon is part of master page
    – Taran Goel
    Feb 29 '16 at 13:56
  • I have used this code. But it is not working.<SharePoint:SPSecurityTrimmedControl ID = "spstcSiteActions" runat = "server" PermissionsString = "ManageWeb"> <span ribbon"> <PublishingSiteAction:SiteActionMenu runat="server"/> </span> </SharePoint:SPSecurityTrimmedControl> Is there anyway to work on this?
    – Gracy
    Feb 29 '16 at 14:05

I have used sp services for finding the user is admin or not then based on user hiding the gear icon and code placed in master page, see below.

   <script type="text/javascript" src=".../jquery.min.js></script>
   <script type="text/javascript" src=".../jquery.SPServices-0.6.2.min.js</script>
<script type="text/javascript">
            $(window).bind("load", function() {
                  operation: "GetUserInfo",
                  userLoginName: $().SPServices.SPGetCurrentUser(),
                  completefunc: function(xData, Status) {
                    var UserAdmin = $(xData.responseXML).find("User").attr("IsSiteAdmin");  
                    if (userAdmin  == "False")  
                    $('#O365_MainLink_Settings').hide(); // gear icon id

Working fine for me check this enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.