Hide the SharePoint Ribbon

Hide the SharePoint Ribbon

The ribbon in SharePoint 2010 is visible to users regardless of the user’s permission. Even for anonymous users it will show up (just with the Navigate Up button). In order to hide the SharePoint ribbon from users, we will need to modify the master page or pages that are available to users without permissions.

The ribbon in SharePoint 2010 is visible to users regardless of the user’s permission. Even for anonymous users it will show up (just with the Navigate Up button). In order to hide the SharePoint ribbon from users, we will need to modify the master page or pages that are available to users without permissions.

The way to implement this is to add code to the master page based on the user’s permission. The following are the steps required to do this:

1. Open the SharePoint master page in SharePoint Designer.

2. Locate the “s4-ribbonrow” div element in the HTML code, and add to it style=”display:none” so that it looks like this:

<div id="s4-ribbonrow" class="s4-pr sr-ribbonrowhidetitle" style="display:none">

 3.  Locate the end dive element of the “s4-ribbonrow” and add the following code after it. We will use the “AddAndCustomizePages” permission string to verify whether or not the user has access to the site.

<SharePoint:SPSecurityTrimmerControl ID="SPSTCRibbon" runat="server" PermissionsString="AddAndCustomizePages">
    <script type="text/javascript" language="javascript">
        document.getElementById("s4-ribbonrow").style.display = "block";
    </script>
</SharePoint:SPSecurityTrimmedControl>

4. Save the Master Page, Check it in and Publish it. If you don’t publish the page you will not see the changes when you are not Signed In.