Friday, November 26, 2010

SharePoint 2010 Master Page Ribbon Hide

Tried a few techniques this one suits me best...

Set the in-line style for both the id="s4-statusbarcontainer" and id="s4-ribbonrow" div's to style="display:none". Then somewhere appropriate below both elements in the master page insert the following:

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


This will cause the ribbon and status notification to be rendered by the browser yet be hidden so the page will still operate normally. If the user is authenticated and allow to modify pages it will render the JavaScript to override the hidden style.

[courtesty of Rich Krott]

1 comment:

  1. Just found this sweet feature on codeplex. its a complete solution, adds a Ribbon Visibility link under Site Administration.
    I haven't tried it yet, but i'm sure i'll need it soon enough

    Show or Hide SharePoint 2010 ribbon based on SharePoint Groups Feature.
    http://spribbonvisibility.codeplex.com/

    ReplyDelete