开发者

Show User Name but hide everything else on the SharePoint Ribbon

开发者 https://www.devze.com 2023-03-06 19:58 出处:网络
On SharePoint 2010 I was able to figure out how to hide the SharePoint Ribbon links (site actions -- page --browse) with the following code on the master page:开发者_StackOverflow中文版

On SharePoint 2010 I was able to figure out how to hide the SharePoint Ribbon links (site actions -- page --browse) with the following code on the master page:开发者_StackOverflow中文版

<SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl2" runat="server" PermissionsString="ManageLists">

<SharePoint:SPRibbon>
...
</SharePoint:SPRibbon>

</SharePoint:SPSecurityTrimmedControl>

But this also hides the domain\username

Where do I put the code to hide everything except the username? I am ok with creating more than one trimmedControl.


You can simply open your Master Page using Sharepoint Designer 2010 and add Asp.Net:LoginName control instead of SharePoint Ribbon as following

<asp:LoginName runat="server" id="LoginName"></asp:LoginName>

I hope that help

Regards.


I believe this is the control in the master page that you want to not hide:

<wssuc:Welcome id="IdWelcome" runat="server" EnableViewState="false">
</wssuc:Welcome>


Hide your ribbon like this

<Sharepoint:SPSecurityTrimmedControl runat="server" Permissions="ManageLists">
    <div id="s4-ribbonrow" class="s4-pr s4-ribbonrowhidetitle">
    .
    .
    .
    </div>
</SharePoint:SPSecurityTrimmedControl>          

Then search your code for the line Mark told you

<wssuc:Welcome id="IdWelcome" runat="server" EnableViewState="false">
</wssuc:Welcome>

Copy and paste the above line anywhere inside a placeholder in the master page. All I did was add a new <td> in the table

<table class="s4-titletable" cellspacing="0">
     <tr>
         <td>...</td> <td>...</td> ... <td> </td>
         <td>
             <div class="s4-trc-container-menu">
                  <div>
                    <wssuc:Welcome id="IdWelcome" runat="serve EnableViewState="false">
                    </wssuc:Welcome>
                 </div>
             </div>
         </td>
     </tr>
</table>
0

精彩评论

暂无评论...
验证码 换一张
取 消