Tuesday, November 9, 2010

Hiding ribbon except for admin

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


<style type="text/css">
#s4-ribbonrow { display : none; }
</style>
3) Now find the start of the "s4-ribbonrow" tag and add following block before this:

<Sharepoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl2" runat="server" PermissionsString="AddAndCustomizePages">
<style type="text/css">
#s4-ribbonrow { display : block; }
</script>
</Sharepoint:SPSecurityTrimmedControl>
4) Save the new master page and publish it.

Article:
Similar article ( Thanks nilesh ) Hide ribbon , Hide/Show Codeplex project

2 comments:

Unknown November 17, 2010 at 9:51 AM  

Nice trick. You saved my day :)

In my case, I needed users to be able to have access to the Welcome control and therefore moved it out of the ribbonRow.

Anonymous,  February 12, 2013 at 1:30 PM  

Great, Thanks!