Today my manager came up with the requirement that Recycle Bin Link in Quick Launch Menu should be visible to Administrator only.
If it was the case for a webpart then I could easily specify the Target Audience and voila. But unfortunately webpart zone is not available for Quick Launch Menu and I didn’t want to write custom menu just to hide the RecycleBin link so the genius came up with the following dirty trick. (Yes, I have recognized myself as a genius since childhood).
1. Launch the SharePoint Designer.
2. Navigate to _catalogs -> masterpage -> default.master.
3. Create a backup of the master page file and open original for editing.
4. Scroll down till the bottom and paste the following javascript code right before </Body> Tag:
var UserID = document.getElementById('zz8_Menu').innerHTML;
UserID = UserID.split('<')[0]; UserID = UserID.split('\\')[1]; if (UserID != 'Administrator') { //Hide Recyclebin var objRecycleBin = document.getElementById('ctl00_PlaceHolderLeftNavBar_idNavLinkRecycleBin'); if (objRecycleBin) { objRecycleBin.style.display = 'none'; } }
5. Save and it should hide Recyclebin for all users except for the administrator.
Note: Please check for the Ids ctl00_PlaceHolderLeftNavBar_idNavLinkRecycleBin and zz8_Menu by view source.
Monday, July 6, 2009
SharePoint Designer 2007 - Hide the Quick Launch Link
Subscribe to:
Post Comments (Atom)
-
Scenario: Updating the Master Page for SharePoint Online is not recommended by Microsoft now.....fine. So how do we change the UI then? And...
-
Microsoft introduced Office Graph a couple of months back which uses machine learning techniques to connect people to the relevant content,...
-
I have recently contributed to the official SharePoint documentation for developement. Check it out here: https://docs.microsoft.com/en-us...
Official SharePoint Documentation
I have recently contributed to the official SharePoint documentation for developement. Check it out here: https://docs.microsoft.com/en-us...
Hello and thanks for the post,
ReplyDeleteDoes this solution work for any other site which is added manualy?? ex: if I just add a link in quick launch and want to hide it,
and is it possile to access the file you have mentioned without SharePoint Desigenr??
Thanks again
one more question, does it hide the Recyclebin for Users with Administrator UserName or with Aministrator Rights??
ReplyDeletecoz there can be more than one administrator for the site!
Post1 (Answer): You have to add this script to the Pages where you want to hide the menu. However, a better way to do this is explained in this post: http://mysplist.blogspot.com/2009/11/security-on-sharepoint-website-controls.html.
ReplyDeleteAlso, you need SharePoint Designer to make changes to the aspx pages.
Post2 (Answer): Yes, It does.
Post 2: It hides the user having Administrator name.I know its a bad solution but again, a better solution is here:
ReplyDeleteURL: http://mysplist.blogspot.com/2009/11/security-on-sharepoint-website-controls.html.
HI
ReplyDeleteYou can use this css
.ms-navframe
{
display:none;
}
this will work