Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / productivity / SharePoint / SharePoint2013

Hide SharePoint Top Ribbon for all Users Except Site Collection Administrators

5.00/5 (1 vote)
6 Jul 2016CPOL 12.6K  
How to hide Sharepoint designer ribbon for all users except site collection administrator

Introduction

This tip will help you to hide the top ribbon on the Sharepoint site collection.

  1. Navigate SharePoint Site and click Sit Settings from Setting Menu
  2. Click Master Pages and Page Layouts link in Web Desginer Galleries section
  3. Download seattle.html page
  4. Make the following changes in the masterpage code

Add the below code before s4-workspce div " <div id="s4-workspace" class="ms-core-overlay">"

The JavaScript code document.getElementById("ms-designer-ribbon").style.display = "block";
will be executed only if the logged on user is site collection administrator, because we set the permission string value as "FullMask". If you want to hide the menu only for anonymous user, then change the PermissionString as AnonymousUsersOnly. The permission string possible values are given below:

Image 1

JavaScript
<!--MS:<Sharepoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl2"
   runat="server" PermissionsString="FullMask">-->
           <script type="text/javascript">//<![CDATA[

       document.getElementById("ms-designer-ribbon").style.display = "block";

           //]]>
           </script>
       <!--ME:</Sharepoint:SPSecurityTrimmedControl>-->

History

  • 5th July, 2016 - Initial version created

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)