0

I am working on a SP2013 Master page. I want to retain the top blue bar (so that the user name remain at right top corner) and hide the lower ribbon bar by permission (so that user without permission cannot click "follow" or "share")

In the Master page, I wrapped the ms-designer-ribbon with SPSecurityTrimmedControl:

<SharePoint:SPSecurityTrimmedControl Permissions="EditListItems" runat="server">
            <div id="ms-designer-ribbon">
                <PublishingRibbon:PublishingRibbon runat="server" />
            </div>
        </SharePoint:SPSecurityTrimmedControl>

However, not only the lower ribbon bar is hidden, the top blue bar also gone. Is there any way to hide only the lower ribbon bar?

1

Publishing Ribbon is the abstraction of all the things you see on the ribbon. its On or Off. For individually controlling , You need to use SPRibbon and adjust the promoted actions delegate control

1

Try something like this -

  1. Target the "s4-ribbonrow" div
  2. Hide this div, may be by using inline-style
  3. Locate the end of "s4-ribbonrow" div
  4. Add this snippet after that div -

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

    < script type="text/javascript">

       document.getElementById("s4-ribbonrow").style.display = "block";
    

    < /script>

    < /Sharepoint:SPSecurityTrimmedControl>

  5. And here you have it, Save your master page and it should work

P.S. Change the PermissionsString as per your requirement.

  • This is a great little solution. One thing: You do have to target the DIV on your style sheet because this DIV (s4-ribbonrow) is emitted at runtime and you can't put an inline style on it directly on your master page. Also, if you do not target the ID with a high enough order of precedence (specificity) it will not take effect. Use this on your stylesheet to target the row: .ms-belltown-authenticated #s4-ribbonrow, .ms-belltown-authenticated .ms-belltown-anonShow {display: none} – Wade Jun 28 '17 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.