Search This Blog

Tuesday, October 1, 2013

On SharePoint, Hide the “Sign – in As A Different User” option through JQuery Or Other Options

A simple script you can add to your master page or content editor etc. to hide the “Sign in As a Different User” option that is available in the Personal Actions Menu.
<script src="/jQuery/jquery-1.4.1.js" type="text/javascript"></script>
<script type="text/JavaScript">
jQuery(document).ready(function($) {
var objects = document.getElementsByTagName("ie:menuitem");
for (var i = 0; i < objects.length; i++) {
itm = objects[i];
if (('#' + itm.id).indexOf("LoginAsDifferentUser") != -1) {
$('#' + itm.id).remove();
}
}
})
</script>
********************************************
Go to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\CONTROLTEMPLATES\
You there have a file call welcome.ascx and have action to  "LoginAsDifferentUser"
<SharePoint:MenuItemTemplate runat="server" id="ID_LoginAsDifferentUser"
                Text="<%$Resources:wss,personalactions_loginasdifferentuser%>"
                Description="<%$Resources:wss,personalactions_loginasdifferentuserdescription%>"
                MenuGroupId="100"
                Sequence="100"

                UseShortId="true"/>

No comments:

Post a Comment