Get SharePoint Online (Office 365 Enterprise E3) Subscription for your Business NOW

SharePoint 2013/2010 Hide Ribbon from Anonymous users or read-only users


This SharePoint tutorail, we will discuss how we can hide ribbon from anonymous users in SharePoint 2013/2010. If your site is accessible by anonymous users then we can hide the ribbon from anonymous users by doing the following customization.

We can easily hide ribbon for read only users or Anonymous users in SharePoint 2010/2013.


SharePoint 2013 hide ribbon from Anonymous users

Here we need to modify the master page, so first take a backup of the master page or you can create a new master page from the existing master page and can modify on that. Here we are going to modify in Seattle.master page, so I have taken a backup of the master page.

Now open your SharePoint designer 2013, click on Master Pages from left side Site Objects. It will open the master page list. Select the particular master page Right click Check out, then Right click and click on Edit File in Advanced Mode.

Then in the master page search for

Modify that line withe style=”Display:none” attribute which should look like below:

Then go to the end tag. You can put mouse cursor in the above line then right click and click on “Select Tag”. This will select the whole tag. And below to the end tag write the below stuff:

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

Now Save the master page and login with anonymous user, the ribbon will not appear.

SharePoint 2010 Hide Ribbon for read-only users

This SharePoint 2010 tutorial explains how to hide ribbon for read-only users in SharePoint 2010. The ribbon is a very good feature provided by SharePoint 2010. But in some case, you need to hide the ribbon from users who do not have access to edit the page.

Here you can hide ribbon from users who do not have edit access by modifying in the master page in SharePoint 2010.

First, open your master page in SharePoint designer 2010 and also take a backup for your master page. Remember we are going to modify in the v4.master page.

After taking the backup, now check out the master page and search for and replace this with .

We have given one id property which is id=”HeaderNavID” and one style property which is style=”display:none”

Now go to the close tag of the above div and place the below code

<Sharepoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl2″ runat="server" PermissionsString="AddAndCustomizePages">
<script type="text/javascript">
document.getElementById("HeaderNavID").style.display = "block";
</script>
</Sharepoint:SPSecurityTrimmedControl>

Hide Ribbon From Anonymous Users in SharePoint 2010

Now, we will discuss How To hide ribbon from anonymous users in SharePoint 2010. So that anonymous users will not be able to see the ribbon.

Open your SharePoint v4.master page in SharePoint designer

Locate this line:

<div id=”s4-ribbonrow”>

Change it to:

<div id="s4-ribbonrow" style="display:none">

Now find the end of the “s4-ribbonrow” tag and add following block right after it:

<Sharepoint:SPSecurityTrimmedControl ID=”SPSecurityTrimmedControl2″ runat=”server” PermissionsString=”AddAndCustomizePages”>
<script type=”text/javascript”>
document.getElementById(“s4-ribbonrow”).style.display = “block”;
</script>
</Sharepoint:SPSecurityTrimmedControl>

Save the v4.master page and publish it.

Read an article on SPSecurityTrimmedControl in SharePoint 2013/2010.

For more information, you can see this blog also which I followed.
http://blogs.msdn.com/b/zwsong/archive/2010/04/29/how-to-hide-ribbon-from-users-without-edit-page-privilege.aspx

You may like following SharePoint 2010 tutorials:

Hope this SharePoint 2010 tutorial explains how to hide ribbon for read-only users in SharePoint 2010. Also, we saw how to hide ribbon from Anonymous users in SharePoint 2013.

Check out Best Alternative to InfoPath -> Try Now

EnjoySharePoint YouTube Channel

You May Also like the Following SharePoint Tutorials:

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →