Hiding ribbon except for admin in SharePoint 2010

Scenario

Client wanted to hide the ribbon from everyone except admin.

Solution

1. Open your SharePoint master page

2. Add the following style in head section

1.  <style type="text/css">  

2.  #s4-ribbonrow { display : none; }   

3.  </style>  

3. Now find the start of the "s4-ribbonrow" tag and add following this:

1.  <Sharepoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl2" runat="server" PermissionsString="AddAndCustomizePages">  

2.      <style type="text/css">  

3.          #s4-ribbonrow { display : block; }  

4.      </script>  

5.  </Sharepoint:SPSecurityTrimmedControl>  

4. Save the new master page and publish it.

Ebook Download
View all
Learn
View all