Wednesday, May 26, 2010

Hiding SharePoint 2010 Ribbon

One of the very first ways my organization wanted to customize their SharePoint 2010 look and feel was to hide the new Ribbon for normal site visitors. Without at least contribute permissions the ribbon provides almost no functionality so why confuse the users by even letting them click on it.

Through many days of trial and error I found this to be the best method to hide the Ribbon without breaking your SharePoint 2010 scroll bar:

Open SharePoint Designer 2010 (download from Microsoft)
Go to the Site Collection you wish to modify and AFTER making a backup copy of the v4 master page, use the following steps to modify your site's master page:
  • Locate this line:
<div id="s4-ribbonrow" class="s4-pr s4-ribbonrowhidetitle">
  • Modify this to:
<div id="s4-ribbonrow" class="s4-pr s4-ribbonrowhidetitle" style="display:none">
  • Find the END of the “s4-ribbonrow” </div>
     tag and add these controls 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 new master page, publish as new major version, and approve if source control is enabled.
This will use security trimming to hide the SharePoint 2010 Ribbon for any user that does not have enough permissions to AddAndCustomizePages

(Note --- I am still working on a clean way of displaying the Sign In portion of the banner for all users, until then my workaround is to add a separate manually created Sign In link to the quick launch bar on the left)


Suggestions and improvements are always greatly appreciated so feel free to post other methods...

No comments:

Post a Comment